#################################################################
#LFSLapper changelog: Updated @ 27-11-2020
#################################################################
+---------------------------------------------------------------+
|Changes from 7.0.6.3 to 7.0.7.0	|
+---------------------------------------------------------------+
=================================================
New: 
=================================================  
	1: New function: PlayerDelayedcommand(); #Start delayedcommand for a specific player

			$UserName = "Bass-Driver";
			$NameOfDelay = "CloseButton";
			$DelayInSeconds = 3;
			$SubCallBack = "ThisSub";

			PlayerDelayedcommand($UserName,$NameOfDelay,$DelayInSeconds,$SubCallBack);

	2: New function: RemovePlayerDelayedCommand(); #Remove delayedcommand for a specific player

			$UserName = "Bass-Driver";
			$NameOfDelay = "CloseButton";

			RemovePlayerDelayedCommand($UserName,$NameOfDelay);

	3: New function: RegisterPlayerDetection(); #Detect player within a fieldofview and distance. 

			#Example
			#$userName = Set Player for the detector
			$userName = "Bass-Driver"; #The Detector is now enabled for Bass-Driver

			#$FieldOfView = Set range of the view to detect players. (degrees)
			$FieldOfView = 30; #view will be 0 to 30 and 0 to -30

			#$Distance = Max distance of detection (Meters)
			$Distance = 25;

			#$NameofSubDetected = Execute Subcallback when 1 or more players are detected.
			$NameofSubDetected = "PlayerDetected";

			RegisterPlayerDetection($userName,$FieldOfView,$Distance,$NameofSubDetected);

			#==========================================
			#Sub callback
			#==========================================
			Sub PlayerDetected($userName,$DetectedPlayer)
				OpenButton( $userName, "PlayerName",170,115,30,5,2,5,96, "^3Player: ^7".GetPlayerVar($DetectedPlayer,"NickName"));
				OpenButton( $userName, "Speed",170,120,30,5,2,5,96, "^3Speed: ^7".GetPlayerVar($DetectedPlayer,"InstantSpeed")." km/h");
				OpenButton( $userName, "Distance",170,125,30,5,2,5,96, "^3Heading: ^7".GetPlayerVar($DetectedPlayer,"Heading"));
			EndSub
			
    4: New Function: SetCarHandicap();
		#This function applies handicap to all drivers using a particular car model
		$Car = "XRT";
		$H_Mass = 100;  CarMass 0 - 200 in KG
		$H_Tres = 10;	Car AirIntake in %

		SetCarHandicap($Car,$H_Mass,$H_Tres);
		
	##################################################################################
	#DISCORDBOT FEATURES
	##################################################################################
	5: New Event :
	
	- This event will be executed when someone sends a discord message to LFSLapper.
	- A Discordbot must be created to communicate between LFSLapper and Discord.
	- In 'bin/default/includes/myInc.LPR' you can enter the 'DiscordToken' and the 'Discordchannel' to receive the messages from.
        - Link to create a discordbot: https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token
	- Set DeveloperMode in your discordsettings to "ON' to copy the channel ID ( rightclick on the channel)

		Event OnReceiveDiscordMessage($DiscordUname,$Text) # Player event
			#Your code
		EndEvent

	#This function sends messages to your selected discordchannel.
	#The discordbot must be connected while using this function

	6: New Function: sendmessagetodiscord();
		$DiscordChannel = "000000000000000000";
		$Message = "Hello";
		sendmessagetodiscord($DiscordChannel,$Message);
	
	7: New setconfigvar() value: "DiscordBotStatus"
 		setconfigvar("DiscordBotStatus",$argv); #change the status of the discordbot
	##################################################################################
	
	8: New Playervar: 'CurrLap' GetPlayerVar($userName,"CurrLap");
		retreive players current lap.


=================================================
Changed: 
================================================= 
	1:Hostname now visible when lapper succesfully connected to a server.
	2:New errormessages to MSS file before Lapper starting (faulty adminpass)
	3:Realtime driftscore refreshrate is set to 5 times a second instead of 10.
	4:NumtoMSH(); returns values in HH:mm.ss format, was HH.mm.ss before.
    	5:Event oncrossingchecker: returns now which insim checkpoint you crossed.
		Checkpoint >> 
		1st checkpoint
		2nd checkpoint
		3rd checkpoint
		Finish line

    	6:Event oncrossingchecker: returns time in H:mm:ss format.
	7:GetWr();  allows 1 parameter "CAR". Example below
	CASE "!getwr":
		IF($argv != "")THEN
			$GetWRInfo = GetWR($argv);
		ELSE
			$GetWRInfo = GetWR();
		ENDIF
		privmsg("^7============================");
		privmsg("^3WR Info:");
		privmsg("^7============================");
		privmsg("^7Car: ^8".$GetWRInfo["CName"]);
		privmsg("^7Track: ^8".$GetWRInfo["Track"]);
		privmsg("^7Racer: ^8". $GetWRInfo["racerName"]);
		privmsg("^7Time: ^8".NumToMSH($GetWRInfo["WRTime"]));
		privmsg("^7Sp1: ^8".NumToMSH($GetWRInfo["Split1"]));
		privmsg("^7Sp2: ^8".NumToMSH($GetWRInfo["Split2"]));
		privmsg("^7Sp3: ^8".NumToMSH($GetWRInfo["Split3"]));
		privmsg("^7Last: ^8".NumToMSH($GetWRInfo["SectorLast"]));
	BREAK;
	8:GetWR(); Added 2 new values: Date & Time. Date/Time of WR
		$GetWRInfo["Date"]);
		$GetWRInfo["Time"]);

	9: Reduced IS_BTN Packetsize with 16 Bytes
	10: Reduced IS_MTC Packetsize with 8 Bytes
	11: Event: OnPlayerFlags
	
		Changed Variables: Event OnPlayerFlags($userName,$YellowFlag,$BlueFlag,$Value,$Time) # Player event
			-Removed Lag Variable : it spammed the event alot in certain cases.
			
		#Explaination of '$Value'	
		When $YellowFlag = 1
			$Value : 1 			== $userName is causing a Yellowflag
			$Value : 0 			== Clear
		
		When $BlueFlag = 1
			$Value : username 	== Faster Driver (username) is behind $userName
			$Value : 0 			== Faster Driver (username) overtook  $userName

=================================================
Fix: 
=================================================
    1: WriteLine() :Lapper crash when try to convert special LFS characters
    2: Write() :Lapper crash when try to convert special LFS characters
    3: LFSLapper.LPR : one of the debugoption turned on
    4: LFSLapper.LPR : debugmessages
    5: No returning value when accidently applying NumtoMSH(); twice
    6: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 24 to 10000
    7: Linux/mono users couldnt start Lapper on their computer
    8: GetWR(); Couldnt get RO11 WRtime
    9: Lappercrash when running 2 lapper instances with the same remoteport.
   10: Lappercrash on Joinrequest() when Playerheight is lower than 0.
   11: Returning Webrequests didnt execute. 

+---------------------------------------------------------------+
|Changes from 7.0.6.2 to 7.0.6.3				|
+---------------------------------------------------------------+
=================================================
Changed: 
=================================================
	1: GetLapperVar(ShortDate): Possible to add a 2nd parameter to add/delete days
			$NewDate = GetLapperVar(ShortDate,5); 	// Adds 5 days to the current date
			$NewDate = GetLapperVar(ShortDate,+5);	// Adds 5 days to the current date
			$NewDate = GetLapperVar(ShortDate,-5);	// Deletes 5 days to the current date
=================================================
Fix: 
=================================================
	1: InstantSpeed Playervar didnt reset to '0' after going to pit or spec (Shift+P / Shift+S)
	2: Angle of car didnt reset to '0' after going to pit or spec (Shift+P / Shift+S)
		-This could spam Event OnAngleVelocity() after losing control and pit/spec at the same time.
	3: Event OnTakeOverCar(): 	Typo in sourcecode, didnt execute the event.
	4: RegisterScheduledAction():	Function did not execute when only minutes are set. 
		-Rewrote small code of RegisterScheduledAction() and (Priv/Host)DelayedCommand();
		-Lapper will now check, if it is a scheduled action or a delayedaction.
	5: RegisterZoneAction ID still remains when a player pit/specs while standing inside a zone.
+---------------------------------------------------------------+
|Changes from 7.0.6.1 to 7.0.6.2				|
+---------------------------------------------------------------+
=================================================
Fix: 
=================================================
 	1:RegisterScheduledAction bug: Executed every second.
	2:DelayedCommand: When out of sync with the current time, delayed command wont executed anymore. ( Old Bug)
+---------------------------------------------------------------+
|Changes from 7.0.6.0 to 7.0.6.1				|
+---------------------------------------------------------------+
=================================================
Changed: 
=================================================
	1: GetLapperVar("racetime"); More accurate racetime.
	2: Privmsg(); Can now be used in non-playerevents.
	3: EditFile(); can now delete lines. 
		Set '-1' as $NewText and set $LineToEdit which line you want to delete.
	###EXAMPLECODE### 
		$Filename = "TestFile";
                $Folder = "C:\Users\Blah\Desktop";
                $NewText = -1;
                $LineToEdit = 5;  # 5 to create a extra line
                $Extension = ".txt"; 
                EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);

=================================================
Fix: 
=================================================
 	1: Couldnt clear the selected objects with SetLytSelection();
		-Keep the function empty to clear the objects: SetLytSelection();

=================================================
Removed: 
=================================================
	1: 2 functions in Sourcecode for requesting: GetLapperVars.
		-Requesting Lappervars is a littlebit faster (not really noticable) and using less CPU Usage

+---------------------------------------------------------------+
|Changes from 7.0.5.0 to 7.0.6.0				|
+---------------------------------------------------------------+
=================================================
New: 
=================================================
	1: New LapperFunction: CreateDirectory();
		$Source = "C:\Users\Danny\Desktop";
		$Name = "TestDir";
		CreateDirectory($Source,$Name);
		
	2: New LapperFunction:  DeleteDirectory();
		$Source = "C:\Users\Danny\Desktop";
		$Name = "TestDir";
		DeleteDirectory($Source,$Name);
		
	3: New LapperFunction:  DirectoryExist();
		$Source = "C:\Users\Danny\Desktop";
		$Name = "TestDir";
		IF (DirectoryExist($Source,$Name) == 1) THEN
			privmsg("Directory Exist!");
		ELSE
			privmsg("Directory does not Exist!");
		ENDIF
		
	#New Math Functions:
	4: New lapperfunction: Cos(); #Calculate Cos
	5: New lapperfunction: Sin();
	6: New lapperfunction: Tan();
	#Examples:
 		$cos = Cos(66);
        $sin = Sin(66);
		
		$angle = 30;
		$Pi = 3.14;
    	$Radians = $angle * ($Pi/180);
    	$tan = Tan($Radians);

        privMsg("Cos: " . $cos);
        privMsg("Sin: " . $sin);
		privMsg("Tan: " . $tan);

	7: New debugoptions in LFSLapper.LPR # Will be displayed in you lapper console.
		-$DisplayGetPlayerVar = 0; 	#Display GetPlayerVars
		-$DisplaySetPlayerVar = 0; 	#Display SetPlayerVars
		-$DisplayLapperVar = 0; 	#Display LapperVars
		-$DisplayLapperFunction = 0; 	#Display LapperFunctions
		
	8: New LapperFunction:  GetLytSelection(); # Request info about objects selected in layout editor - response is seen in OnObjectInfo event with $Action 5
	
	9: New LapperFunction:  SetLytSelection(); #Set objects to clipboard or set them as selected objects.	
		CASE "!setsel": 
			# X:Y:Z:Flag:Index:Heading,X:Y:Z:Flag:Index:Heading,...
			$obj_L = "-244.25:-1282.62:17:1:178:0,-244.25:-1282:16.75:229:178:0";
			$obj_A = "-244.25:-1281.88:16.5:33:178:-180,-244.25:-1281.56:17:9:178:0,-244.25:-1281.25:16.5:33:178:0";
			$obj_PP = "-244.25:-1280.12:16.5:1:178:0,-244.25:-1279.88:17:25:178:0,-244.25:-1280.69:17:25:178:0,-244.25:-1280.94:16.5:1:178:0";
			$obj_E = "-244.25:-1279.19:16.75:1:178:0,-244.25:-1278.69:17:225:178:0,-244.25:-1278.62:16.5:225:178:0,-244.25:-1278.69:17.5:245:178:0";
			$obj_R = "-244.25:-1278.44:16.5:1:178:0,-244.25:-1278.19:17:25:178:-180,-244.25:-1277.88:16.5:65:178:0";
			
			$objects = $obj_L.",".$obj_A.",".$obj_PP.",".$obj_E.",".$obj_R;
			$PMOFlag = 0; # PMOFlag 0 -> clipboard selection, PMOFlag 4 -> select placed objects
			SetLytSelection($PMOFlag,$objects);
		BREAK;
=================================================
Changed: 
=================================================
    1: GetListOfLayout(); will display all the layouts instead of only the layouts of the current track
	2: Soundoption for globalmsg(); / privmsg(); 
		NOTE: is compatible with older scripts.

		0 = No Sound
		1 = Message Sound
		2 = SystemMessage Sound
		3 = InvalidKey Sound
		4 = ERROR Sound
		5 = NUM Sound

	-Possible options for globalmsg() : 
		globalmsg("BLAHBLAH");
		globalmsg("BLAHBLAH",0);
	-Possible options for privmsg() :
		privmsg("BLAHBLAH");
		privmsg("BLAHBLAH",0);
		privmsg($userName,"BLAHBLAH");
		privmsg($userName,"BLAHBLAH",0);

	3: X and Y playervars now returns Floating values: -123.45 instead of rounded -123
	4: JoinRequest(); allows now floating X and Y values. See the line above.
	5: RegisterZoneAction() allows floating X and Y values.
	6: Event OnObjectInfo() New way for displaying Object info. See Code Example in LFSLapper.LPR 

	Old: OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading)
	New: OnObjectInfo($userName,$NumO,$Action,$ObjectsInfo)

=================================================
Fixed: 
=================================================
    1: Lappercrash when a non existing folder is added in addonused.lpr Include().
    2: Path of several script in addonsused.lpr were wrong.
    3: PlayerVars couldnt be used in OnDisconnect Player event.
    4: Japanese Charbug
    5: HTTP(); A Host or other invalid player couldnt send a webrequest.
    6: Connectioninfo(); Must to execute this function twice after reloading lapper to set the playervars ( language,IP)
	7: Lappercrash when a $var is placed outside a sub or (Catch)event
    8: NON-admins couldnt add/remove objects since the last LFS Version
	9: Typo in hardcoded objectslist.
	10: Event OnObjectInfo didnt displayed floating values.
	11: AddObject()/RemoveObject() doesnt work when input values have 1 digit behind the comma. (XX,5 instead of XX,50)
	12: GetLapperVar("RaceTime") could increase CPU usage when use it in a loop.
=================================================
Removed: 
=================================================
    1: AFK/IDLE Timer playervar ( randomly stopped working)

+---------------------------------------------------------------+
|Changes from 7.0.4.10 to 7.0.5.0 								|
+---------------------------------------------------------------+
        -New Functions
        -New Events
        -Many minor bugfixes
=================================================
New: 
=================================================
=================================================
NEW EVENTS:
=================================================
    01: New Event: Event OnTakeOverCar($Player_Old,$Player_New,$Car)
        Event executes when someone takes over someone cars.

    02: New Event: Event OnLapValidation( $userName,$HVLC,$Time )
        Reports when a player hits a wall, goes off track, goes Out of Bounds, Speeds in the pitlane
            #Output of $HVLC
            # 0 : Off Track 
            # 1 : Hits Wall 
            # 4 : Speeding in pitlane 
            # 5 : Out of Bounds

    03: New Event: OnInterfaceMode()  VERSION LFS 0.6R12 required!!!!!
         -Reports in which menu the Player is.
         -Also report when a admin is editing an object in Shift+U mode

         Event OnInterfaceMode($userName,$Mode,$SubMode,$SelObject,$Time) # Player event
         	#YourcodeHere
         EndEvent
=================================================
NEW FUNCTIONS:
=================================================
    01: New Function: GetAngle(); See attachment
        -Get the angle of location or player , depends on your Cars Heading. 

            $Angle = GetAngle($userName,$userName);
            $Angle = GetAngle($TheLocation,$userName);
            $Angle = GetAngle($userName,$TheLocation);
            $Angle = GetAngle($TheLocation,$TheLocation);
            $Angle = GetAngle("-150:26","-150:26"); #(X:Y,x:y)

    02: New Function: CarSwitches();     //More info in Docs/CarSwitches
        -Set switches of your car lights,horn,siren,flash,signals
        NOTE: You must be a host to enable this function.

    03: New Lapperoption: DebugSettings , in LFSLapper.LPR
         -When set one of the options below, it will displayed the executed subs/events/Loops in your Lapper console.
         $DisplaySubs = 0;  #Player created subs
         $DisplayLoops = 0; #DelayedCommand functions,
         $DisplayEvents = 0; #(Catch)Events

         #Note: These settings are in a testfase, there is a chance that some subs not will be displayed in your console.

    04: New Function: FileExist();
        -Check if a file exist.
        $Folder = "C:\Users\Danny\Desktop";
	$FileName = "Testfile";
	$Extension = ".txt"; 
	IF (FileExist( $Folder,$FileName,$Extension ) == 1) THEN
		privmsg("File Exist");
	ELSE
		privmsg("File does not Exist");	
	ENDIF

    05: New Function: GetListOfFiles();
        
	$Folder = "C:\Users\Danny\Desktop\CruiseFolder";

	#Get an array of files from the folder 
	   $ListOfFiles = getlistoffiles($Folder);
	
	$NumberOfFileInFolder = 0; #This is the first file in the folder

	#Values you can get from each file.	
	   $FileNumber = $ListOfFiles[$NumberOfFileInFolder,"FileNumber"];
	   $FileName = $ListOfFiles[$NumberOfFileInFolder,"FileName"];
	   $CreationDate = $ListOfFiles[$NumberOfFileInFolder,"FileCreated"];
	   $ModifiedDate = $ListOfFiles[$NumberOfFileInFolder,"FileModified"];
	   $FileSize = $ListOfFiles[$NumberOfFileInFolder,"FileSize"];	
						
     06: New Lappervar: 'Lapperstate'
		-Check which state your lapper is. Stable or experimental etc

=================================================
Updates: 
=================================================
    	01: Lapper Console: Message/command length increased from 30 characters to 80 characters
    	02: Lapper Console: Message/command sendtime decreased from 1000 milliseconds to 100 milliseconds
    	03: Lapper Console: Server Connecting messages.
    	04: WriteLine();  Possible to use colortags  ^0 - ^8  See attachment
    	05: Write();      Possible to use colortags  ^0 - ^8
    	06: Sqlite Database libraryfiles. (not mono yet)
    	07: Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Type,$InDex,$Heading) # Player event
	//Added new value for $Action
	//Get GroundLevel ZByte.
    	08: LFSLapper.LPR main scriptfile.
    	09: Update TrackList.cfg . Thanks Sinanju :)
    	10: Possible to not allow AI on track. THANKS LakynVonLegendaus 
		####################
		#Disable AI drivers# (Can be found in LFSLapper.LPR below $DefaultTopCar option)
		####################
		# If enabled, LFS will not allow AI drivers to join race (/ai) and all AI drives that are already on track will be spectated on Lapper start/reload
		$DisableAI = -1;	# Enable (1) or disable (-1)


    	11: Add/Removeobject: Floating values for X / Y / Z axis are now possible
	12: Add/Removeobject: Non-floating input values will now be converted into floating values
	13: Lapper no longer returns $userName converted to lowercase format
	14: UserGroupToFile no longer converts usernames to lowercase format

=================================================
Fix: 
=================================================
    01: FO8 characterbug in SetAllowedCars();
    02: F08 characterbug in AllowedPlayerCars();
    03: Remove($String,$StartIndex,$NumberOfChars) : Error when StartIndex is lower than 1.
    04: Addobject(): Lapper crash when X and Y values are floating (comma) numbers (0,00).
    05: Addobject(): Lapper crash when Heading value is negative.
    06: Removeobject(): Lapper crash when X and Y values are floating (comma) numbers (0,00).
    07: Removeobject(): Lapper crash when Heading value is negative.
    08: EditFile(): Lappercrash caused by a wrong hardcoded errormessage.
    09: Lapper Console: Lapperserver 'stopped' message while starting a lapperserver.
    10: Hosts also executed Flooding Events.
    11: No error messages for StartLightControl.
    12: joinrequest: Lapper crash when CarHeading is lower than 0.
    13: (Priv/Host)Delayedcommand: Cannot be executed when settime is not equal with the current time. 
        The Delayedcommand task stays in the list and will never be executed. 
        Continues loops could hang. And had to be resetted manually.
    14: Add/Removeobject: Heading value wasnt calculated correctly. And negative values werent possible.
    15: Random UCO insimpacket crashes
    16: AFKTimer/IdleTimer PlayerVars
	

+--------------------------------+
|Changes from 7.0.4.8 to 7.0.4.10| #7.0.4.9 is skipped, caused by a big sourcecode bug
+--------------------------------+
        -New Lappervars added
        -New Events/InsimPackets added : OnPlayerFlags , OnAdminCommandReport
=================================================
New: 
=================================================
        01: New lappervars added: (retrieve values from LFS)
		
        mustpit                //MustPit is enabled on the server ( Returns 0 or 1)
        canvote                //Guest may vote kick/ban  ( Returns 0 or 1)
        canselect              //Guest may select track/car  ( Returns 0 or 1)
        canreset               //Guest may reset theire car  ( Returns 0 or 1)
        midracejoin            //Guest may join during a race  ( Returns 0 or 1)
        cruise                 //Guest is allowed to drive the wrong way  (Returns 0 or 1)
        forcedcockpitview      //Forced cockpitview  ( Returns 0 or 1)
        nbofcheckpoints        //Number of checkpoints ( Returns 0, 1, 2 or 3) Also works on layouts (Insim checkpoints doesnt count)
        timing                 //Type of Timing:
                            -Returns 0 : Open config without use checkpoints
                            -Returns 1 : Normal laptiming ( normal circuit)
                            -Returns 2 : Custom/AutoX laptiming ( userplaced checkpoints/finishline)
		lapperversion			//Returns only the lapperversion
		lfsmode					//Returns mode of LFSServer (Demo/S1/S2/S3)
		lfsversion				//Returns version of LFSServer : currently 0.6R
		
        02: New Event: OnPlayerFlags (Detects Yellow/Blue flags and Lag/Missing packets)
        
            ##########################################################################################
            #Action on Event when player receives a Flag (Yellow/Blue flags and Lag/Missing packets).
            ##########################################################################################
            #The Flags below returns 1 or 0 depends on which flag is received by the user
            #$YellowFlag:     Player receives a YellowFlag
            #$BlueFlag    :     Player recieves a BlueFlag
            #$LagFlag     :     Player is lagging or is missing carpackets
            #$Time        :     ShortTimeFormat,same as GetLapperVar("ShortTime");

            ##########################################################################################
            $PlayerFlagEvent = -1; #Enable Event  1 = ON / -1 = OFF
            Event OnPlayerFlags($userName,$YellowFlag,$BlueFlag,$LagFlag,$Time) # Player event
				/*
				IF( $YellowFlag == 1) THEN
				privmsg("^3YELLOW FLAG");
				ENDIF
				IF( $BlueFlag == 1) THEN
				privmsg("^4BLUE FLAG");
				ENDIF
				IF( $LagFlag == 1) THEN
				privmsg("^5LAG");
				ENDIF
			   */
            EndEvent
                
        03: New Event: OnAdminCommandReport (Report admincommands)
        
            ######################################################
            #Action on entering a admincommand ( "/ commands" )
            ######################################################
            #$userName = username of the player who typed the admincommand.
            #$IsAdmin = Is player a admin ( 0 = no admin  / 1 = is an admin)
            #$Status = Status of command ( 1 - processed / 2 - rejected / 3 - unknown command) 
            #$Command = Entered command by player
            #$Time = Date/Time of action
            ######################################################

            Event OnAdminCommandReport( $userName,$IsAdmin,$Status,$Command,$Time )  # Player event
                #Yourcode
            EndEvent

        04: New Function: InArray(), Check if a value already exist in the current array.

            #Array = $TESTARRAY[]
            #Value = 7
            
            IF( inarray($TESTARRAY,"7") == 1) THEN
                privmsg("^2Does exist");
            ELSE
                privmsg("^1Does not exist");
            ENDIF

        05: New Function: Remove(), Remove chars from a string. Old way: Trim( SubStr ());

            There are 2 ways to use the function
            
            Remove amount of characters from the string from StartIndex
            1 : $NewString = remove($OldString,$StartIndex,$Charstoremove)
            or
            Remove everything from StartIndex
            2 : $NewString = remove($OldString,$StartIndex)

        06: New event: OnHostMSO($Text,$Time) (Thanks to LakynVonLegendaus)

              #Every messages by the host will be sent to this event.
              #DO NOT USE GlobalMsg()!!!!!!!!!!!!!!!!!!!!!!!!!!!!
              Event OnHostMSO($Text,$Time)
				#YourCode
              EndEvent
		 
		 07: New event: OnPlayerSelectCar($userName,$Car,$Time) # Player event
		 
			#This event will execute when a player select a car in the garage
             Event OnPlayerSelectCar($userName,$Car,$Time)
				#YourCode
             EndEvent
		
		 08: New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)
		 
			#######################################
			#Player sends a join request (Shift+J)#
			#######################################
				NOTE: 	
				#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
				#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
				#To respond to a join request - use joinrequest() function.
				#The Player's unique ID (PLID Must be 0 to use the join request system)	
				#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
				#For more info see ..\LFS\docs\InSim.txt	
				
				$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.
				
				Event OnNewJoinRequest( $userName )  # Player event
				/*
					    $Flags = 0;  #Move car (128) else (0)
						$X_Axis = 0;  #X axis SpawnPoint 
						$Y_Axis = 0;  #Y axis SpawnPoint
						$Z_Axis = 0;  #Z axis SpawnPoint
						$Heading = 0;  #Heading of the players car at Spawnpoint
						
						$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
						$PLID = 0;  #GetCurrentPlayerVar("PLID"); #Player's unique ID
						
						###$PLID MUST BE 0 TO USE JOIN REQUEST###
						#$JRRAction = 0;  # Reject join request.
						$JRRAction = 1;  # Allow join request.
				
					joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
				*/
				EndEvent


=================================================
Updates:
=================================================

        01: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 24 to 10000

                $list = GetListTop( getConfigVar( DefaultTopCar ), 0, 0 );
                Note: Users must edit theire script to see the max visible Records. This can be done with a FOR loop: ( $i=0;$i<25;$i=$i+1)


=================================================
Fixes:
=================================================
		01: Removed GLobalmsg(); in Layoutlist.LPR. Spammed the chat after paging up or down
			 
+-------------------------------+
|Changes from 7.0.4.7 to 7.0.4.8|
+-------------------------------+
	-Sort Arrays function
	-Several functions to edit strings
	-Delete stored values from the database
	-Delete userstored values from the database
	-New Lappervars
	-Set/Get allowed cars on the server.
	-Create/Edit/Read/Delete Textfiles.
	-Old RemoveZoneAction() bugfix.
	-Other Fixes.
	-Small updates on errormessages
	-Small Sourcecode cleanup.

=================================================
New: 
=================================================

	01: New Function: Sort() Sort Arrays
	
		Sort(Var,"TypOfSort") Sort Arrays  , TypOfSort = DESC or ASC: Sort values descending or ascending
			$testArray[0] = A;
			$testArray[1] = B;
			$testArray[2] = C;
			$testArray[3] = D;

			$Sortedarray = Sort($testArray,$TypOfSort);

			FOR ( $i = 0; $i < 4 ; $i = $i + 1)
     				privMsg( "^3" . $Sortedarray[$i] );
			ENDFOR

	02: Delete Stored (Player) Vars from database
	
		DeleteUserStoredValue($userName,"Value"); #Delete user stored values from the database
		DeleteStoredValue("Value");	#Delete stored values from the database
	
	03: New Function: SetAllowedCars() Set Allowed cars on the server. (This is not the same as allowedPlayerCars($username,$Cars))
	
		$Cars = UF1+XRT+UFR;
		SetAllowedCars($Cars);
		
	04: New lappervars added: (retrieve values from LFS)
		-Wind (returns 0,1 or 2)
		-Weather (returns 1,2 or 3)
		-RaceLaps (returns number of Laps) Returns 0 IF Hours is set
		-RaceHours (return number of Hours) Returns 0 IF Laps is set
		-allowedcars (Returns string of cars : UF1+XRT+XFG for example)

	05: New function: Contains() Returns 1 or 0
		$String = "teststring";
		IF (Contains($String,"test") == 1) THEN
		    #yourcode
		ENDIF
		
	06: New function: Replace() Replace chars in a string
		$oldstring = "LFSLapper String Test";	
		privmsg("Old String: ".$oldstring);

		$newstring = Replace($oldstring,"","_");
			
		privmsg("New String: ".$newstring);

	07: New function: Insert() Insert chars in a string.
		$oldstring = "LFSLapper String Test";
			
		privmsg("Old String: ".$oldstring);
		$newstring = Insert($oldstring,21," [Extra String]");
			
		privmsg("New String: ".$newstring);

    	08: Created $TimeFormat var for 12 or 24hour format. used for the following LapperVars

        	GetLapperVar("ShortTime");
        	GetLapperVar("LongTime");

        	//The code below can be found in LFSLapper.LPR
        	$LongTimeFormat = "HH:mm:ss tt";
        	$ShortTimeFormat = "HH:mm";
                	# Used for GetLapperVar("LongTime") and GetLapperVar("ShortTime")
                	# HH = Hour in 0-23 format
                	# hh = Hour in 0-12 format
                	# mm = Minute
                	# ss = Seconds
                	# t = A/P "hh:mm:ss t"
                	# tt = AM/PM "hh:mm:ss tt"	

	09: Create/Read/Delete Textfiles
		#===================================================
		#Create textfiles (Include FileExist options) (only .txt extension)
		#===================================================
				$FileName = "Filename";
				$NameofDirectory = "C:\Users\User\Desktop";
				$FileExistOption = 0;
			
			   What todo if file exist:

			   0 = no action
			   1 = overwrite file
			   2 = overwrite file + create backup file.

			   CreateFile($FileName,$NameofDirectory,$FileExistOption);
        	#===================================================
		#Delete textfiles (Include copy file option)
		#===================================================    
				$FileName = "Filename";
				$NameofDirectory = "C:\Users\User\Desktop";
				$NameofCopyDirectory = "C:\Users\User\Desktop\Copy";  #or $NameofCopyDirectory = "";
				$Extension = ".txt";
				
				DeleteFile($FileName,$NameofDirectory,$NameofCopyDirectory,$Extension);
		#===================================================
		#Read file (Possible to read various Filetypes: .log/.txt/.ini/.cfg.lpr)
		#===================================================
				$LinesofFile = Readfile($Filename,$Folder);
				What info you get from file.
				
				-FileSize in bytes
				-CreationDate/Time
				-ModificationDate/Time
				-Number Of lines
				-LineNumber
				-Text from each line
				
				!!!!EXAMPLE CODE!!!!
				
					$Filename = "TestFile";
					$Folder = "C:\Users\Danny\Desktop";
					$Extension = ".txt";
					$LinesofFile = Readfile($Filename,$Folder,$Extension);
					
				
					$NrOfLines = ToNum($LinesofFile["NumberOfLines"]);
					$FileCreationDate = $LinesofFile["TimeOfCreation"];
					$FileModificationTime = $LinesofFile["TimeOfModification"];
					$FileSize = $LinesofFile["FileSize"];
					
					privmsg("Reading file: " . $Filename . "" .$Extension);
					privmsg("NumberOfLines: " . $NrOfLines . "");
					privmsg("Size of file: " . $FileSize . " bytes");
					privmsg("Creation time: " . $FileCreationDate . "");
					privmsg("Modify time: " . $FileModificationTime . "");
					
					FOR ( $i = 0; $i <= $NrOfLines-1 ; $i = $i + 1)
						$linenr = $LinesofFile[$i,"LineNumber"];
						$line = $LinesofFile[$i,"Line"];
						privmsg("[".$linenr."]: ".$line);					
					ENDFOR

		!!!!!!!!!! USE THE FOR/WHILE LOOP, ONLY FOR THE LINES YOU WANT TO BE DISPLAYED ON YOUR SCREEN !!!!!!!!!!!!!!!!!!!
			
		#===================================================
		#Edit file (Possible to read various Filetypes: .log/.txt/.ini/.cfg/.lpr)
		#===================================================
		
				$Filename = "TestFile";
				$Folder = "C:\Users\Danny\Desktop";
				$NewText = "TESTTEST";
				$LineToEdit = -1;  # -1 to create a extra line
				$Extension = ".txt"; 
				EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);
		
=================================================
Updates:
=================================================

	01: Files with LapperVars and LapperConfigvars updated.
	02: Deleted !powered command: command became obsolete
	03: Few errormessages updates (typo's & imcomplete info).
		
=================================================
Fixes:
=================================================
    	01: ToNum(); Wrong error message when PlayerVar is empty.
    
    	02: Several RemoveZoneAction() fixes: 
        	-Leave Subroutine still active after removing zone.
        	-Lappercrash when deleting Zone in not particular order.

    	03: Several fixes on ErrorMessages (some caused lappercrashes)
    	04: Error on !ver command. caused by a invalid URL in webcommand
    	05: Incorrect tracknames from lapper when ShortTrackName contains more than 4 characters.
    	06: Lappercrash on subStr ($string, 4, 1);  when Startindex is larger than the length of the string.
	07: Incorrect errormessages for RegisterScheduleAction(); 
		-Returns an errormessage when ID or Sub routine value is empty.
		-Returns an errormessage when the time/date field is incorrect.

+-------------------------------+
|Changes from 7.0.4.6 to 7.0.4.7|
+-------------------------------+

-Editable DriftTop script !drf
-Editable UserTop script !usertop
-Delete Driftscore from database
-Delete Laptimes from database
-Create streets and get info of current street ID
-Updated Errormessages (ERR Files)
-Location Databases changed
-Deleted some old hardcoded functions
-Retrieve list of layouts from server
-RealTime DriftScore
-Several Fixes: LFSlapper Crashes,Typos,Old Bugs

=================================================
New:
=================================================
	01: Driftscore table is now editable. // drifttop.lpr

		$list = getlisttopdrift( $argv,$flagQual,$flagNear ); #Get List from database  
	 
		!drf command in LFSLapper.lpr
		
	02: Usertop table is now editable. // usertop.lpr

		$list = getlisttopuser( $value,$flagdesc,$flagNear,$filter ); #Get List from stored database

		!usertop command in LFSLapper.lpr
		
	03: New functions. Delete records from database (single one or all)
	
		deletedriftrecords();  #Delete driftscores from current track
		deletelaptimerecords();  #Delete laptime records from current track
		
		Options:
		-Delete a single record from current track: deletelaptimerecords(Username,Car)
		-Delete a specific car from current track:  deletelaptimerecords(-,Car)
		-Delete a specific username from current track: deletelaptimerecords(username,-)
		
		Commands can be found in: utils.lpr  Bin/default/includes/utils.lpr
		!dellr = Delete laptime record.
		!deldr = Delete driftscore record.
			
	04: New Function: Register Street Action
 
		RegisterStreetAction( name of street,trackname,width of street,coordinates of street(separated by commas), callbackfunctionOnEnter,callbackfunctionOnLeave );
		Callback command is executed when a street is entered or left by a player
		 
		Example:
		 
		RegisterStreetAction( Pitlane boulevard,WE1X,7,-201,233,-201,266,-202,316,-202,353,-202,389,-202,439,-202,487,-202,536,-201,561, EnterStreet, LeaveStreet );
		On track WE1X, When Coordinate -201,233 is Reached the Sub EnterStreet is executed.
		On track WE1X, When Coordinate -201,561 is Reached the Sub LeaveStreet is executed.
		 
		Patch for this function is created by Nick Axworthy.
		
	05: New Playervars: according to the the new function above
	
		currstreet
		idcurrstreet
		
	06: Load Layout system 
		
		###How to get list of layouts###
		-LFSLapper MUST be on the same machine as your LFSServer
		-Set Path of layoutfolder in LFSLapper.LPR (Line 207) Example: $LayoutFolder = "C:\LFS_0.6R\data\layout";
		-Type !LayoutList (in Utils.LPR) to open the list.
		-Click
		
		#Features#
		-List with layouts that are currently available on the server.
		-No need to be a serveradmin anymore to load a layout(admin management)
		-Number of layouts for current track
		-LayoutName
		-Modification Date
		-Creation Date
		-Editable script like Usertop/DriftTop
		
		###Script idea's##
		-Possible to create a Layout rotator system.
		-Create a favo layout window.
		-Layout Vote system

	07: Realtime Driftscore option

	    $RealTimeDriftScore = -1; Set 1 to enable this feature.
	    -This may have effect on Lapper performance with many player in the server.
	    -Do not use this with the buildin DriftMeter Scripts. 	
=================================================
Update:
=================================================	
	
	01: ErrorMessages updated.
	
		Some examples:
		
		OLD: "Incorrect args number in function: Functionname".
		NEW: "Incorrect number of parameters in function: Functionname".
		
		OLD: "Need int in 2nd parameter of:  Functionname".
		NEW: "2nd parameter of function: Functionname. is not a valid Integer value".
	
	02: Location Databases changed.
	
		-Created a map for the Grip & Drift & StoredValue Databases. You can find them in the 'Databases' folder (Bin/default/Databases)
		
	03: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 18 to 24
	
		
=================================================
Fix:
=================================================	
	01: Lappercrash when LeaveZone/LeaveNode sub-routine is enabled.
	
	02: Lappercrash when adminpass is wrong.
	
	03: Typo in Playervars: GetPlayerVar();
	
	    	OLD: IPAdress
		NEW: IPAddress
		
		OLD: DecimalIPAdress
		NEW: DecimalIPAddress
		
	04: Added few non-documented PlayerVars to the PlayerVar list
		-NumberPlate
		-IsHost

	#Function Fixes:

	05: Round(Var,2) : Weird Errormessage when using it with stored Playervars from the database.

	06: RemovePrivDelayedcommand() : Weird errormessage when using this function in the OnDisconnect Event.
=================================================
Removed:
=================================================	
	01: Several Old hardcoded functions for DriftScoreTable and Usertop
	
		closetop();
		top();
		near();
		topqual();
		nearqual();
		topuser();
		nearuser();
		drf();
		drfqual();
		drfnearqual();
		drfnear();


+-------------------------------+
|Changes from 7.0.4.5 to 7.0.4.6|
+-------------------------------+
=================================================
New:
=================================================
    01 New function: layoutinfo(); Layout information ISP_AXI Insimpacket (DONE)
        -Number of objects
        -Number of Checkpoints
        -Number of startarrows
        -Layoutname: (only when lapper is loaded on a local server)
           
    02 New PlayerVars: Extra player info ISP_NCI Insimpacket (DONE)
    //These vars are set after the player has joined the server
              GetPlayerVar($userName,"LFS_Language"));
              GetPlayerVar($userName,"LFS_UserID"));
              GetPlayerVar($userName,"DecimalIPAddress"));
              GetPlayerVar($userName,"IPAddress"));
              
        To retreive extra info about the players AFTER lapper is loaded:
        connectioninfo();
              
    03 New PlayerVars: AFKTimer/IdleTimer (DONE)
                GetPlayerVar($userName,"AFKTime")); # Not being active in the server (Driving/Sending messages)
                GetPlayerVar($userName,"IdleTime")); #Not driving the car (on the road).

=================================================
Updated:
=================================================
    01: Max stored laptime is now 30 minutes instead of 5 minutes. (DONE)
        //Laptimes higher than 30 minutes will not be stored in the Lapper database.
        //Reason: For very long layouts.
    
=================================================
Fixed: 
=================================================
    01: Lapper Crash: After loading/clearing layouts (DONE)
    02: Lapper Crash: After loading new track (DONE)


+-------------------------------+
|Changes from 7.0.4.4 to 7.0.4.5|
+-------------------------------+
=================================================
New:
=================================================
	01 - New Function: Add/Remove Objects
		It is possible to add/remove objects up to 30 objects at once
		
		#X:Y:Z:Flag:Type:Heading
		$Object_One = "19:-654:3:208:175:64";
		$Object_Two = "20:-654:3:208:175:64";
		
		addobject($Object_One,$Object_Two);
		removeobject($Object_One,$Object_Two);
		
		If one of the parameters of the object is incorrect,  function will abort its action.
		In the errorfiles you can see which object is incorrect.
				
	02 - New Function: Distance Measurement between Player <> Player  / Player <> Object / Object <> Object
		
		trackuserdistance();
		
		With this function you can display the distance between 2 players or between a other location and a player.
		See some examples below.
		
			trackuserdistance($userName,$userName);
			trackuserdistance($TheLocation,$userName);
			trackuserdistance($userName,$TheLocation);
			trackuserdistance($TheLocation,$TheLocation);
			trackuserdistance("-150:26","-150:26"); #(X:Y,x:y)

								
	03 - New Event : Get info about the objects you add/removed by autocross editor
		
			$DisplayObjectInfo = -1; #Set -1 to disable this event
			Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading) # Player event
				privmsg("^7LayoutAction: ^8".$Action);
				privmsg("^7Number of Objects: ^8".$NumO);
				privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
				privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
				privmsg("^7ObjectFlag ^8".$Flags);
				privmsg("^7Heading of Object ^8".$Heading);
			EndEvent

+-------------------------------+
|Changes from 7.0.4.3 to 7.0.4.4|
+-------------------------------+
=================================================
New:
=================================================
	1.	New LapperFunction: AllowedPlayerCars($UserName,$Cars);
	 
			$UserName = Bass-Driver;
			$Cars = XFG+XRT+RB4;
			AllowedPlayerCars($UserName,$Cars);
		
	2.	New LapperVar: GetLapperVar("racetime");
			Time will be reset after restarting the race.
	
=================================================
Update: Lappercore/Script Updates.
=================================================
	1.	Update Sub Callback for	RegisterNodeAction() & RegisterNodeAction()

			The Callback Sub for RegisterZodeAction() & RegisterNodeAction() is having a extra variable.

			Example:

			RegisterNodeAction( TESTID, getLapperVar( "ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );
			Sub test($UserName,$ZoneID)
			   privmsg("ID=".$ZoneID); #output is TESTID
			EndSub	
				
			Now it is possible to call this sub with differend Node/Zone actions
			
			NOTE: Sub Callback with 1 variable will cause errors in the ERRORfiles.
=================================================
Fixed: Lappercore fixes.
=================================================
	1.	Event OnAngleVelocity( $userName )
			This event will now also execute with negative Angle values. (When you cars spins to the right or to the left)
			Previously, only executes when car spins to the left.

	2.	RemoveNodeAction();
			Lapper crashed when removing node with invalid NodeID.
		
	3.	RemoveZoneAction();
			Lapper crashed when removing zone with invalid ZoneID.
	
+-------------------------------+
|Changes from 7.0.4.0 to 7.0.4.3|
+-------------------------------+

Version 7.0.4.1 https://www.lfs.net/forum/post/1905751#post1905751
Version 7.0.4.2 https://www.lfs.net/forum/post/1909748#post1909748
		1. New Event: (LFSLapper.LPR)

			Event OnCarStateChanged($userName,$StateOfCar)
			
				IF($StateOfCar == 0)THEN
					globalmsg(getplayervar($userName,"NickName")."^7 Stopped the car!");
				ENDIF
				IF($StateOfCar == 1)THEN
					globalmsg(getplayervar($userName,"NickName")."^7 Start driving!");
				ENDIF
			
			EndEvent

	2. New PlayerVars:
		-GetCurrentPlayerVar("Heading"); #Direction of forward axis : 0 = world y direction
		-GetCurrentPlayerVar("Direction"); #Car's motion if Speed > 0 : 0 = world y direction

	3. Changed:
		-Fixed Typo's & Changing Pitworks in sourcefile Insim4.cs ( Thanks to Iceman121 for reporting the typo's and idea's)

		Mechanicals Damages >> Mechanical Damage
		Body Dammage >> Minor Damage 
		Major Damage

		Refuel >> Refuelling
		Wheels & Transmissions >> Wheels

		-Characterlenght increased to 120 chars instead of 67 for the following functions:
		Privmsg() 
		GlobalMsg()

	4. Fixes:
		-Sourcecode bugfix: in GLScript.cs ( Thanks to Yisc[NL] for reporting the bug)
		Link of report: https://www.lfs.net/forum/post/1906238#post1906238

		-Sourcecode bugfix (CSC) (CarState Packet) implemented in version 7.0.4.1
		LFSLapper crashed after getting player without a username (HOST)

		-Minor bugfixes in LFSLapper.lpr ( Thanks to Yisc[NL] for reporting the bug)
		Link of report: https://www.lfs.net/forum/post/1906123#post1906123

		-JoinRequest fixes:
		Lapper crashed when JoinRequest() have less than 8 parameters
		Lapper crashed when Heading value > 254
		Lapper crashed when spawning a spectating player

		-StartLightControl fixes:
		Lapper crashed when startlightcontrol() have less than 4 parameters

	5. Removed/Edited
		-Welcomes Message ignored in Default Helpmenu(includes/cif/config_membership.lpr)
		-Enabled Welcomes message in LFSLapper.lpr (Event OnConnect( $userName ))
		-Playervars.txt in 'doc' folder edited.
		-Playerinfo.txt in 'doc' folder edited.
	
+-------------------------------+
|Changes from 7.0.4.0 to 7.0.4.0|
+-------------------------------+
    1. New Event:
        Event OnCarStateChanged($userName,$StateOfCar) #When a player's car change state (For now Start/Stop)
        
    2. Several fixes in LapperScripts:
		LFSLapper.LPR
		
			privMsg( langEngine( "%{main_outpitwindows}%", GetCurrentPlayerVar("NickName"] ) ));
			Changed to:
			privMsg( langEngine( "%{main_outpitwindows}%", GetCurrentPlayerVar("NickName") ) );

			privMsg( langEngine( "%{main_pitwork}%", GetCurrentPlayerVar("pitWork") ) );
			Changed to:
			privMsg( langEngine( "%{main_pitwork}%", GetCurrentPlayerVar("PitWork") ) );

+-------------------------------+
|Changes from 7.0.3.0 to 7.0.4.0|
+-------------------------------+
    1. New Lapperfunction:
        startlightcontrol(5,149,1,1); #Control AutoX StartLights // More info in 'Control StartLights.txt'  in 'Docs' folder.  includes Examplecode
        
    2. Renamed/added Objects for $DetectHitobject var.
        Changed: All_Railings' renamed to 'All_Armco
        Add:    Railing

+-------------------------------+
|Changes from 7.0.1.0 to 7.0.3.0|
+-------------------------------+
	1. LapperInsimVersion changed to Version 7

	2. New Events: 
		Event OnCarContact($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y)  # Player event
		Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)  # Player event
		
	3.New PlayerVar:
		Z,   //Height of player on track 
+-------------------------------+
|Changes from v6.014 to 7.0.1.0 |
+-------------------------------+
	1. New player vars (case sensitive):
        ObjectContactSpeed,     //Speed of player when hitting a object
		ObjectContactHead,      //Heading of player when hitting a object
		ObjectContactDir,       //Direction of player when hitting a object

		AccelerationStartSpeed2, // Min value for the acceleration feature relative to user unit km or mph
		AccelerationEndSpeed2,   // Max value for the acceleration feature relative to user unit km or mph
		AccelerationTime2,       // Acceleration time achieved from start to end speed

	2. New Lapper Vars
		$AccelerationStartSpeed2 = 100; # At which speed to start measuring time. In km/h
		$AccelerationEndSpeed2 = 160; # At which speed to stop measuring time. In km/h
		$AccelerationStartSpeedMph2 = 60; # At which speed to start measuring time. In Mph
		$AccelerationEndSpeedMph2 = 100; # At which speed to stop measuring time. In Mph
		$AccelerationPrivateMaxTime2 = 10; # Maximum acceleration time in seconds to show message
		
		$DetectHitObject = "";  #To get objectstrings for detection look at docs/ObjectHit.txt
		
	3. New Events:
		Event OnAcceleration2( $userName )  # Player event
		Event OnObjectHit($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType)  # Player event


+-------------------------------+
|Changes from v6.013 to 6.014   |
+-------------------------------+
	1. New player vars (case sensitive):
        "Sector"  Get the current sector that the racer is in
        "LastSector"  Get the last sector that the racer was in

	2. Recompiled under MonoDevelop
	
	3. New functions:
		sqrt ( $num ) - returns the square root of a number
		
+-------------------------------+
|Changes from v6.012 to 6.013   |
+-------------------------------+
	1. New Vars:
		Player vars (case sensitive):
		"IsHost" - is the current player the host (UCID = 0)

	   Lapper vars:
		"trackid"  Get the current TrackID as a numberic (i.e. BL1 = 100)
		"elapsedms" - get current race time in milliseconds

	2. New functions:
		RequestREO  Requests an OnREO be triggered with grid order
		NumToMs  Convert a number to Milliseconds
		TextPrivButtonAll  Update the text on a global button that all players have displayed (like a countdown)
		HostDelayedCommand - Set a delayed command on the host rather than a player
		RemovehostDelayedCommand - Remove the host based delayed command by name
		GetWr - Get the current World Record for a car/track combo

	3. New events:
		OnRaceEnd  race end (return to game setup screen)
		OnREO ( $NumP, $ReqI, $GridOrder ) - Receive a REOrder (when requested or when race restarts after qualifying)
		
	4. Other fixes:
		GetPlayerInfo function has now been fixed to return numeric values as well as strings
		Updated Track Name functions to allow for "open" configs using X & Y
		OnChangeTyres will now be called whenever a player finishes a pit stop - allows checking for race conditions like num tyres changed
		Race grid will not reorder at start if you have customised the grid
		Loop timings decreased to allow for greater accuracy in things like countdown loops
		
	5. To-do list:
		Race reorder functions need to be finished to allow for custom grids
		Car contact code incomplete, although this would require splitting player and connection data to allow for AIs
		CIF modules need to be cleaned up and completed
		
	6. Additional include modules (lpr's):
		CIF modules - updated for new code but some are still beta
		race_duration.lpr - allow race duration to be set in mins (!mins <num>) or kms (!kms <num>)
		pit_marshal.lpr - Displays race distance warnings if mustpit is set and racer has yet to pit
		team_chat.lpr - adds the !tc command to chat to members of your team (must have same team name in square brackets e.g. [LFSNZ]Krayy
		utils.lpr - now using the Community utils.lpr so check if for extra functions
		
		radar_trap.lpr - speed traps for a number of tracks
		

+-------------------------------+
|Changes from v6.011 to 6.012   |
+-------------------------------+
Krayy's patch

  1 . Here's a small update to the GetPlayerInfo function in the scriptFunctions.cs 
      file to allow calling it wothout any paramas returns the current player 
      info e.g called as

      $currPly = GetPlayerInfo();
      Will return the info array for the current player,

      $currPly = GetPlayerInfo("Krayy");
      returns infor for specific player. 

+-------------------------------+
|Changes from v6.010 to 6.011   |
+-------------------------------+
Add Krayy Library

	1. remove old help command in lfslapper.lpr
	2. Add multi tabbed lib in .lpr file, look at gui_help on how to use
	3. New commands in lfs:
		!ma
		!hc
		!help
	        Multi-lang to do in gui_help.lpr



+-------------------------------+
|Changes from v6.001 to 6.010   |
+-------------------------------+
Patch For Krayy

	1. New vars:
        "mustpit"  this returns a 1 or 0 if the /mustpit flag is set in the server (although it only does it when it receives an IS_RST, which is at restart, so maybe we should request an IS_RST at certain times during the race, like 25%, 50% and 75% complete)

	2. New functions:
        Getplayervarbyucid  returns a var when giving the UCID. Used for more compact lpr code when using buttons (see attached gui files, which I will put on forums later)
        Getplayervarbyplid  as above but uses PLID
        Userisserveradmin  has the user logged in as a server admin, or is he a member of admin group, or is he UCID 0?

	3. New event:
        OnButtonFunction  run when user presses Shift+I or Shift+B

+-------------------------------+
|Changes from v5.925 to 6.001   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe
		- who.lpr

	1. No need to unset var if reasigned with getListXXXX GLScript function
	

+-------------------------------+
|Changes from v5.925 to 6.000   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe
	Files to Add in exe folder
	    - libsqlite3.so.0.so
	    - System.Data.SQLite.dll
	    - sqlite3.dll
	Files not yet used
	    - Mono.Data.SqliteClient.dll

+-------------------------------+
|Changes from v5.925 to 5.926   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe
		- addonused.lpr
		- utils.lpr
		- consts.lpr

	1. Add new function RandomNum to have a randomized number
	    RandomNum() return a decimal number between 0 and 1
	    RandomNum(a,b) return a decimal number between a and b
	    RandomNum( -100,100 ) return a number between -100 and 100
	    RandomNum( 100,120 ) return a number between 10 and 120

	2. Add new function isRegexMatch to test if an expression match a regex expr
		Example : To test if a string is a time string
   		    isRegexMatch( "^[0-9]{1}\.[0-9]{2}\.[0-9]{2}", "1.24.30" ) return 1
		    isRegexMatch( "^[0-9]{1}\.[0-9]{2}\.[0-9]{2}", "12.24:30" ) return 0
		    
		search regular expression on the net to know how work regular expressions

	3. Add new function getListOfPlayerButton, this function return an Array containing
	    all the name of the currently displayed player button
	    
	4. Add a new lpr file containing some GLScript usefull fonction
	    Added in this file
	        - closeButtonRegex( $userName, $exp ) to close all button of one player that idOfButton match
	            $exp. $exp it's a regular expression
			- adminMsg to send a message to all admin present on server

	5. Add new event when practice start
	    OnPracStart( $numP ) this event receive number of player present
	    
	6 Add new lapper's vars
	    $raceInProg -> return value 0,1,2 relative to race status, look at consts.lpr
	    $raceId -> an unique race identificator that in the race start date time


+-------------------------------+
|Changes from v5.924 to 5.925   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe

	1. Add new function to open private button for another player
		Syntax :
		    openButton( username, idOfButton, left, top, width, height, interline, secondDisplayed, style, text[,optional_backCall] );

	2. Add new function to close private button for another player
		Syntax :
	    	closeButton( username, idOfButton  );
	    	
	3 - Add new command openTextButton, to open a button who query an input string for a specified player
		openTextButton( "username","ref2",103,140,20,10,10,32,"Caption","Toto",30,saisTxt );

			Open a button for the current player, args are
				1 - UserName of the player who want open a text button
				2 - Unique id for this button
				3 - Left coordinate for this button ( 0-200 )
						$origL = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origL + 5;)
				4 - Top coordinate for this button ( 0-200 )
						$origT = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origT + 5;)
				5 - Width of the button ( 0-200 )
				6 - Heigth of the button ( 0-200 )
				7 - Space between line in multiline button
				8 - Format of the button, look at insim.txt for values
				9 - Caption displayed in the input box
				10 - Button Text
				11 - Number char to be input
				12 - Backcalled sub
				
		Backcalled function receive 2 args
  			first = idOfButton
  			Second = Text
  			Example of called subroutine
  			Sub goto_sub( $id,$text )
				WriteLine( $id );
			EndSub



+-------------------------------+
|Changes from v5.923 to 5.924   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe
        - Add event OnChangePos in LFSLapper.lpr or replace LFSLapper.lpr
		
	1. Fixed bug in setuserstoredvalue when not used in player event
	2. Fixed bug in getuserstorednum when not used in player event
	3. Fixed bug in getuserstoredvalue when not used in player event
	4. Fixed bug in privmsg when not used in player event
	5. Add new LFSLapper function StripLFSColor ti remove all color and lang char in string
	    $var = StripLFSColor("^7toto^8tata");
	6. Add new Event OnChangePos triggered when player change his position in race or qual
	    			Event OnChangePos($userName,$lastPos,$currPos)
	    			    ...
	    			EndEvent


+-------------------------------+
|Changes from v5.922 to 5.923   |
+-------------------------------+
	Files to replace From the previous version
		- LFSLapper.exe
		- Change in LFSLApper.lpr
				old -> Event OnDisConnect( $userName )
				new -> Event OnDisConnect( $userName, $reason )

	1. Add new arg to event OnDisConnect
	    Event OnDisConnect( $userName, $reason ) # Player event
		Look at const.lpr to view reason list
		# Leave Reason on disconnect
			const LEAVR_DISCO		0; # disconnect
			const LEAVR_TIMEOUT		1; # timed out
			const LEAVR_LOSTCONN	2; # lost connection
			const LEAVR_KICKED		3; # kicked
			const LEAVR_BANNED		4; # banned
			const LEAVR_SECURITY	5; # OOS or cheat protection
			
			example:
			    IF( $reason == LEAVR_DISCO ) THEN
			        privMsg( "Normal disconnect");
				ENDIF
			    IF( $reason == LEAVR_LOSTCONN ) THEN
			        privMsg( "Lost connection");
				ENDIF



+-------------------------------+
|Changes from v5.921 to 5.922   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		pitboard.lpr
		
		Add new arg to function RegisterNodeAction and RegisterZoneAction, for
		no modification add "" in the new arg
			old -> RegisterNodeAction( "MyNode", "BL1" , 140 , DisplaySpeed );
			new -> RegisterNodeAction( "MyNode", "BL1" , 140 , DisplaySpeed,"" );

		Add new arg to function RegisterZoneAction with ""
			old -> RegisterZoneAction( "MyZone", "SO6" , -100 , 100 , SA_Test3 );
			new -> RegisterZoneAction( "MyZone", "SO6" , -100 , 100 , SA_Test3, "" );

	1. new arg in functions
		RegisterZoneAction
		RegisterNodeAction

				accept a newArg that is of the subroutine called when leave a zone, node.
	    Example:
			RegisterZoneAction( "MyZone", "SO6" ,  -100 , 100 , SA_Test3, SA_LeaveTest3 );
			RegisterNodeAction( "MyNode", "BL1" , 140 , DisplaySpeed,ExitDisplaySpeed );

		If you don't want a leave subroutine or enter subroutine put "" in arg
			RegisterNodeAction( "MyNode", "BL1" , 140 , DisplaySpeed,"" );
			RegisterZoneAction( "MyZone", "SO6" , -100 , 100 , "", SA_LeaveTest3 );

	2. Fixed bug in !pitwindow command


+-------------------------------+
|Changes from v5.920 to 5.921   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe

	1. Add new event when the drift score is reseted due low speed
		Event OnDriftResetScore( $userName ) # Player event
			....
		EndEvent

	2. New function GetUserStoredNum, like GetUserStoredValue but return a numeric value
	    or -1 if the stored value is a string
	        GetUserStoredNum( key );
	        GetUserStoredNum( userName,key );

	3. New function GetStoredNum, like GetStoredValue but return a numeric value
	    or -1 if the stored value is a string
	        GetUserNum( key );
	        GetUserNum( userName,key );

	4. Fix error on parser when one function splitted in multiline
	
	5. New player Var, this var can also be set
			ViewSPBSplit,			// What split PB to Show, S = Session, P = PB, W = World record
			ShowSplitPb,			// Does the split PB iare showed 1 = Yes, 0 = No
			UnitSpeedKmh,			// What's unit is used for speed and distance 1 = km 0 = miles
			
	6. Add new function GetListOfLang, return an array containig the list of lang available in LFSLapper

	
	
+-------------------------------+
|Changes from v5.919 to 5.920   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		LFSLapper.lpr ( language added )
		defPitInfo.lpr
		driftdef.lpr
		driftmeter.lpr
		winnerflags.lpr
		
	1. Rewriting and cleaning GLScript Parser ( Take 6 hours, arghhh ) Krayy now it's most easy to read :p
		to be tested accurately. This rewrite is to fix this error
		    $myVar = $myVar * -1;
		    now work as intended
	2. Add new operator '!' not
	    !1 -> 0
	    !0 -> 1
		not of a number different to 0 is 0
		
	3. openPrivTextButton now call the callBack subRoutine with 2 arg,
  		first = idOfButton
  		Second = Text
  		Example of called subroutine
  			Sub goto_sub( $id,$text )
				WriteLine( $id );
			EndSub


+-------------------------------+
|Changes from v5.918 to 5.919   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		tops.lpr
		handicapper.lpr

	1. Rewrite the instance management, dirty code replaced with more clean
	    and easy to maintain to try to solve bug in 5.9.1.8
	    
	2. Correct a bug in tops.lpr script file
	
	3. Fix bug when udp connection and reload config ( thank's krayy )
	
	4. Updated handicapper.lpr file
	    

+-------------------------------+
|Changes from v5.917 to 5.918   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe

	1. Fix error when type !stop and then !start in LFS chat window

	2. Autorestart LFSLapper instance on error, 4 times ( only if crash < 10s beetween 2 retry ), then go in standBy mode
	
+-------------------------------+
|Changes from v5.916 to 5.917   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		replace '&' in all multiline button with %nl% or replace LFSLapper.lpr
		replace '&' in all multiline button with %nl% or replace driftmeter.lpr

	1. Separator for multiline message is nox %nl% (newline) instead '&' to avoid
	new line when username or nickname of player contain '&' char

	2. Add new separator in text to display in button ( cycling separator ):
	    %at% is an alternate(s) text, you can have as many alternate text as you
	    want. LFSLapper display all text separated by %at% one every second

	 Example
    	openPrivButton( "drewpitleave02",50,12,100,10,10,10,ISB_DARK,"^1R E M E M B E R !%at%^7R E M E M B E R !%at%D O N ' T  C R Y !" );
    	
    	This display
    	    first "R E M E M B E R !" in red
    	    then "R E M E M B E R !" in white
    	    finally "D O N ' T  C R Y !"
    	    then go to the first message and do one more cycle



+-------------------------------+
|Changes from v5.915 to 5.916   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		driftmeter.lpr

	1. Fix bug on delayed command and registeraction
	
	2. Add new version of driftmeter by Sinanju ( thank you )


+-------------------------------+
|Changes from v5.914 to 5.915   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe

	1. Fix error on storedvalue on migration from 5.8
	
	2. Add players Vars
	    PBDrift to have the drift PB on the current combo
	    
+-------------------------------+
|Changes from v5.913 to 5.914   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe

	1. Fix error on track not set in first rotation
	
+-------------------------------+
|Changes from v5.912 to 5.913   |
+-------------------------------+
	Files to replace From the previous version
		LFSLapper.exe
		LFSLapper.lpr ( or remove !top !topqual !near !nearqual entry in the big case)
		driftdef.lpr
		driftmeter.lpr
	
	1. Fix some error on script due to case sensitivity driftdef.lpr, driftmeter.lpr
	    Thank you very much Tim NL

	2. Fix error in Parsing '(' and ')' under certain condition
	
	3. Fix error in optimization in assignation var or array
	
	4. Add a mathematical function round to make a number rounded
	    round( 12.34,1 )  -> 12.3
	    round( 12.36,1 )  -> 12.4
	    
	5. !top, !near, !topqual, !nearqual are now managed in tops.lpr . You can
	    modify this file to have your own top display
	    next stage drf

	
+-------------------------------+
|Changes from v5.911 to 5.912   |
+-------------------------------+
	Change LFSLapper.exe and LFSLapper.lpr, pitBoard.lpr, who.lpr

	1. Fix some error on script due to case sensitivity in GetCurrentPlayerVar And GetPlayerVar
	    Thank you very much Tim NL
	    
	2. who.lpr now present in release
	
	    
+-------------------------------+
|Changes from v5.910 to 5.911   |
+-------------------------------+
	Change LFSLapper.exe and defPitInfo.lpr from previous version

	1. Fix error on retreive value in stored DBS
	
	2. Fix error when no car is selected
	
	3. Fix error in defpit.lpr script
	
+-------------------------------+
|Changes from v5.906 to 5.910   |
+-------------------------------+

		**** CHANGING TO 5.9 BECAUSE OF BIG CHANGE IN GLScript, Very hard coding ****
		
	1. Rewrite a big part of GLScript Parsing and lexer to cache compilation code.
	    Now very Speed up the execution of the code. Very hard coding
	    Try !gui one time ( caching at this point ), then type !gui ( very faster )
	    
	2. Add new GLScript function
			GetListTop( $argv )
		$argv is the same meaning arg as !top XRG  etc...
			$list = GetListTop( $argv );
			
			This command return a 2 dimension arrayVar containing the result of the top
			Write a test in your script with dumpVar( $list ) to view all available value
			or take a look at tops.lpr the use
			
	3. Create a new script ( to be finished ) for replace builtin command !top with a GLscript command file, you can
	    modify your top look as you want.
	    To view this new top type !mytop in chat line
	    This top is the same as old but only writed in GLScript :-), i remove the builtin code when i finish this
	    script.
	    

	    
+-------------------------------+
|Changes from v5.905 to 5.906   |
+-------------------------------+
	1. Add new player var TotDistMeter that is the distance in meter do by a player
	    this value is set to 0 when a player connect to the server
	    You can set this value by SetCurrentPlayerVar( "TotDistMeter" , 10000 );

	2. Add new config var
	    $distToDo = 100;
	    it is the amount of meter that player must do to trigger new player event OnDistDone, see below

	3. Add new event triggered when a player do a certain distance
		Event OnDistDone( $userName ) # Player event
			writeline( "100m dist done by " . $userName . " - total dist :" . GetCurrentPlayerVar("TotDistMeter") );
		EndEvent


+-------------------------------+
|Changes from v5.904 to 5.905   |
+-------------------------------+
	1. Fix bug on scheduledAction
	
+-------------------------------+
|Changes from v5.903 to 5.904   |
+-------------------------------+
	1. Add blinking button feature on button, value is 8 or use ISB_BLINK const
		Example:
			openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK | ISB_BLINK,langEngine("%{main_accept}%"),OnConnectClose );
			or
			openPrivButton( "clos",78,120,20,10,10,-1,32 + 8,langEngine("%{main_accept}%"),OnConnectClose );
			
			Better use const for more lisibility

	2. new arg in functions
		RegisterScheduleAction
		RegisterScheduleAction
		RegisterZoneAction
		DelayedCommand
		PrivDelayedCommand
				accept a newArg that is an unique id for this Action.
	    this id is usefull when you want remove a RegisterScheduleAction, RegisterScheduleAction, RegisterZoneAction,DelayedCommand,PrivDelayedCommand
	    You can also still continue use this function without this arg
	
	    Example:
			RegisterScheduleAction( "myTest","* * * * * * *", SA_test );
			RegisterNodeAction( "MyNode", "SO6" , 337 , SA_Test2 ); #NodeID,Track,Node,EnterZone
			RegisterZoneAction( "MyZone", "SO6" , -100 , 100 , SA_Test3 ); #ZoneID,Track,X,Y,EnterZone
			DelayedCommand( "MyCommand", SA_Test3 );
			PrivDelayedCommand( "MyCommand", SA_Test3 );


	3. new functions
		RemoveScheduleAction( idSched );
		RemoveNodeAction( idSched, track );
		RemoveZoneAction( idSched, track );
		RemoveDelayedCommand( idSched );
		RemovePrivDelayedCommand( idSched );

	    this functions allow to remove a previous registered action
	    Example:
			RemoveScheduleAction( "myTest" );
			RemoveNodeAction("MyNode","SO6");
			RemoveZoneAction("MyZone","SO6");
			RemoveDelayedCommand( "MyCommand" );
			RemovePrivDelayedCommand( "MyCommand" );

	4. Add a new player Var to know in witch zone the player is
	    if not in zone value is "NONE" else it's the id of the zone event, identifi you zoneaction now.
	    usefull when you want command available only in specific zone
	    Example
	    	CASE "!buyfood":
				IF( GetCurrentPlayerVar( "idZone") == "MyZone" ) THEN
				    ... do what you want ...
				ELSE
				    privmsg( "Command not available here");
				ENDIF


+-------------------------------+
|Changes from v5.902 to 5.903   |
+-------------------------------+
	1. Improve number of simultaneus button allowed on screen to 240 ( LFS limit ) instead 170.
	
	2. Add a timeout feature in script to stop infinite loop. Default is 2000ms
		you can set your own value in LFSServers.cfg
		
		timeOutScript=2000; # Time out in ms

	3. Add player var retreiveid from Pubstat
			PSDistance,				// online statistics of one racer - distance in metres
			PSFuel,					// online statistics of one racer - fuel burnt in cl
			PSLaps,					// online statistics of one racer - laps
			PSHostsJoined,			// online statistics of one racer - hosts joined
			PSWins,					// online statistics of one racer - Wins
			PSSecond,				// online statistics of one racer - Second
			PSThird,				// online statistics of one racer - third
			PSFinished,				// online statistics of one racer - finished
			PSQuals,				// online statistics of one racer - quals
			PSPole,					// online statistics of one racer - pole
			PSDrags,				// online statistics of one racer - drags
			PSDragWins,				// online statistics of one racer - drag wins
			PSCountry,				// online statistics of one racer - country

	4. Add a Sub fonction in LFSLapper.lpr script PstInfo, this function display the pubstat info for one player
	
	5. Add new chat command !ps to display your pubstat info or !ps username to display the pubstat info for
		a player present on server
		
	6. Add new .lpr file consts.lpr, containing some const usefull to write script
	
	
+-------------------------------+
|Changes from v5.901 to 5.902   |
+-------------------------------+
	1. new command const, you can put it in sub/event or outside sub to define const
	    Const are preproced when reading config file, not on execution

	    const MY_CONST 12; # it's global const
	    const MY_CONST2 1 + 23; # it's global const
	    Sub mySub()
		    const LOCAL_CONST 13; # it's local const const only available in sub
		    const MY_CONST2 2 + 89; # This override the global const only in this sub;
		    
		    $i = 12 + MY_CONST + LOCAL_CONST + MY_CONST2; # This is replaced by $i = 12 + 12 + 13 + 2 + 89;
		    
	    EndSub

	2. Fix Bug when setting a local var with global var and global var with localvar

+-------------------------------+
|Changes from v5.852 to 5.901   |
+-------------------------------+
	1. GetListOfPlayer accept an optional argument to sort the list og player
	        Example:
	                $list = GetListOfPlayers("U"); # List sorted by userName
			Or
	                $list = GetListOfPlayers("N"); # List sorted by nickName
	                
	2. Fix groupCmdLfs( cmd ); order in other serv
	
	3. Add GLScript command reload() to stop lapper and reload config
	
	4. CatchEvent eventName structure
		Add new structure feature, it's offer the ability to define code in this struct
		and catch an existing event located in the main lpr file. LFSLapper execute code located
		in event then jump to code located in one or more catchEvent. it's very usefull for creating
		 script without modify the original lpr file.
		To add a new functionality to lapper just add include(newScript) at the end
		of lpr file and to remove put a # before the include.
		newScript must use this CatchEvent.

	        CatchEvent eventName
	        ...
	        EndCatchEvent

	        Example:
		        CatchEvent OnConnect( $userName )
				WriteLine( "OnConnect appended");
			EndCatchEvent

			Before Event OnConnect( $userName ) is executed then execute code
			located into one or more CatchEvent OnConnect( $userName )

	5.      CatchSub subName --> Same as CatchEvent but for sub
		Add new structure feature, it's offer the ability to define code in this struct
		and catch an existing sub located in the main lpr file. LFSLapper execute code located
		in sub then jump to code located in one or more catchSub. it's very usefull for creating
		 script without modify the original lpr file.
		To add a new functionality to lapper just add include(newScript) at the end
		of lpr file and to remove put a # before the include.
		newScript must use this CatchSub.

	        CatchSub mySub
	        ...
	        EndCatchSub

	        Example:
		        CatchSub MySub( )
				WriteLine( "MySub appended");
			EndCatchSub

			Before Sub MySub(  ) is executed then execute code
			located into one or more CatchSub MySub( )

	6. Add userName in args passed to event player
	            OnMSO,OnAuthAllowed,OnAuthNotAllowed,OnAuthReached,OnSwearWords1
	            OnSwearWords2,OnToLowHandicap,OnNotMatchFlags,OnConnect,OnDisConnect
	            OnSplit1,OnSplit2,OnSplit3,OnLap,OnSpbSplit1,OnSpbSplit2,OnSpbSplit3
	            OnSpbLast,OnFlood,OnMaxSessionLaps,OnAngleVelocity,OnMaxNbInStunt
	            OnMaxAllowedLapTime1,OnMaxAllowedLapTime2,OnIdle1,OnIdle2,OnDriftPB
	            OnDriftLap,OnDriftScore,OnPB,OnPBQual,OnAcceleration,OnBeginPit
	            OnEndPit,OnPit,OnNotPitWindow,OnBeginPitWindow,OnEndPitWindow
	            OnFastDriveOnPitL1,OnFastDriveOnPitL2,OnMaxFastDriveOnPit,OnFalseStartL1
	            OnFalseStartL2,OnLeaveRace,OnDriftTooLow,OnGoodDrift,OnNewGapPlayerBehind
	            OnNewGapPlayerBefore,OnNewPlayerJoin,OnChangeTyres,OnFinish,OnResult
	            OnCarReset,OnMaxCarResets,OnExitPitLane,OnEnterPitLane,OnNameChange
	            
	 7. Patch to allow storing data as another user. I.e: ( krayy )

		SetUserStoredValue( "hmass", GetPlayerVar($uName,"h_mass"));
		OR
		SetUserStoredValue( $uName, "hmass", GetPlayerVar($uName,"h_mass"));

		GetUserStoredValue( "hmass" );
		OR
		GetUserStoredValue( $uName, "hmass" );

	8. Fix SQL error when userName have a single-quote (') in it in PB, Drift and stored
	
	9. Add new GLScript function SplitToArray, this function allow splitting a string by a split char and put result into array

		Example:
			$tosplited = "Un,Deux,Trois,Quatre";
			$splites = SplitToArray(  $tosplited,"," );
	        	WriteLine( "The result for pos 2 is " . splites[1] );
			FOREACH( $val IN $splites)
		        	WriteLine( "Val = " . $val["value"]);
			ENDFOREACH

		Result on Screen
			The result for pos 2 is Deux
		        Val = Un
		        Val = Deux
		        Val = Trois
		        Val = Quatre
	

+-------------------------------+
|Changes from v5.851 to 5.852   |
+-------------------------------+
	1. Add new player event : OnNameChange (krayy)
	
	2. Update SuperUser checks to include UCID 0 (dedicated server or LFS host) (krayy)
	
	3. Update finishedpos event to return a valid number at any time as currently
 		it does return a number if the racer has not passed the finish line (krayy)

	4. privMsg now can take 1 or 2 Arg (krayy)
		1 arg, send message to current player;
		        example : privMsg( "myMessage");
		2 arg, Send a message to a specified user
		        example : privMsg( "gai-luron","myMessage");

	5. Fix error on SetUserStoredValue, now accept string for storing
	
	6. Improve array performance and use of specific player array getted with GetplayerInfo
	        if you copy an GetplayerInfo array in another array, you get a sbapshot or a carboncopy of the original array
	        and not a full featured GetPlayerInfo Array.



+-------------------------------+
|Changes from v5.850 to 5.851   |
+-------------------------------+
	1. Add new struct control in GLSCRIPT
	        FOREACH( var IN arrayVar )
	                ....
	        ENDFOREACH
	        
		Whith this struct you can parse an array without knowing index
		put on each iteration one element of the array arrayVar in var
		var is an array containing only index "key", "value"
		"key" is the key in the array
		"value" is the value
		
		Example:
		Script Code
		
			$toto[0,1,0] = "Zero,Un";
			$toto[1,1,0] = "Un,Un";
			$toto[1,2,0] = "Un,Deux";
			$toto[2,2,0] = "Deux,Deux";
			$toto[3,1,0] = "Trois,Un";
			$toto[4,0,0] = "Quatre,zero";

			FOREACH( $myVar IN $tata )
				writeLine( "Key = " . $myVar["key" ] . " Value = " . $myVar["value" ] );
			ENDFOREACH
		Result on screen
			Key = toto,4,0,0 Value = Quatre,zero
			Key = toto,0,1,0 Value = Zero,Un
			Key = toto,1,1,0 Value = Un,Un
			Key = toto,1,2,0 Value = Un,Deux
			Key = toto,2,2,0 Value = Deux,Deux
			Key = toto,3,1,0 Value = Trois,Un

	2. Add new GLScrip Function dumpVar(), to dump the content of a var to screen, debug purpose
	        Example
		In script
	  		$toto[0,1,0] = "Zero,Un";
			$toto[1,1,0] = "Un,Un";
			$toto[1,2,0] = "Un,Deux";
			$toto[2,2,0] = "Deux,Deux";
			$toto[3,1,0] = "Trois,Un";
			$toto[4,0,0] = "Quatre,zero";
			dumpVar( $toto );
		
		print on screen:
			$toto[4,0,0] = "Quatre,zero"
			$toto[0,1,0] = "Zero,Un"
			$toto[1,1,0] = "Un,Un"
			$toto[1,2,0] = "Un,Deux"
			$toto[2,2,0] = "Deux,Deux"
			$toto[3,1,0] = "Trois,Un"

	3. Completely rewriting array management in GLScript, now you can assign an array to a new var or array,
	partially or entirely.
		 Example
		 In Script
			$toto[0,1,0] = "Zero,Un";
			$toto[1,1,0] = "Un,Un";
			$toto[1,2,0] = "Un,Deux";
			$toto[2,2,0] = "Deux,Deux";
			$toto[3,1,0] = "Trois,Un";
			$toto[4,0,0] = "Quatre,zero";

			$tata = $toto;
			$part = $toto[1];
			$var = $toto[4,0,0];
			$inArray[1] = $toto[1];

		Result in Vars:
			$toto[0,1,0] = "Zero,Un";
			$toto[1,1,0] = "Un,Un";
			$toto[1,2,0] = "Un,Deux";
			$toto[2,2,0] = "Deux,Deux";
			$toto[3,1,0] = "Trois,Un";
			$toto[4,0,0] = "Quatre,zero";

			$tata[0,1,0] = "Zero,Un"
			$tata[1,1,0] = "Un,Un"
			$tata[1,2,0] = "Un,Deux"
			$tata[2,2,0] = "Deux,Deux"
			$tata[3,1,0] = "Trois,Un"
			$tata[4,0,0] = "Quatre,zero"

			$part[1,0] = "Un,Un"
			$part[2,0] = "Un,Deux"
			
			$var = "Quatre,zero"
			
			$inArray[1,1,0] = "Un,Un"
			$inArray[1,2,0] = "Un,Deux"
			
	4.	New GLScript command getPlayerInfo( userName ), this function return an array containing all player var.
		!!!!!!!SORRY!!!!!!! but this is the future command who kill the next command list in the future
	        Command killed in the future :-)
	                GetCurrentPlayerVar
	                GetPlayerVar
	                SetCurrentPlayerVar
	                SetPlayerVar

		Set a Var with getPlayerInfo and then use it like an Array Var to retreive player var or to set player var
		funny isn't it?

	                Example:
	                	Event OnConnect( $userName ) # Player event
					$CurrPly = GetPlayerInfo( $userName );          # Set A var for the player infos
					IF( $CurrPly["userName"]  != "" ) THEN          # Kip Host
						WriteLine( $CurrPly["userName"] );      # Retreive a player Var
						WriteLine( $CurrPly["nickName"] );      # Retreive a player Var
						$CurrPly["ess"] = 12; 			# Set a player Var
						WriteLine( $CurrPly["ess"] );
					ENDIF
				EndEvent

	        Next Stage it's send to all parameter event the userName

	5. New GLScript command to have the size of an array
	        arrayCount( array );
	        
	        Example:
			$toto[ 1 ] = "Un";
			$toto[ 2 ] = "Deux";
			WriteLine( $toto );
		Result on Screen
		        2
		        

+-------------------------------+
|Changes from v5.849 to 5.850   |
+-------------------------------+
	1 Removed hardcoded Global Variable $ListOfPlayers[index] replaced, see below
	
	2 Add new GLScrip Function GetListOfPlayers(), return an array containing list of players connected
	        Example
			$i=0;
			$ListOfPlayers = GetListOfPlayers();
			WHILE( $ListOfPlayers[$i] != "" )
			        ... Do What you Want ...
			        $i = $i +1;
			ENDWHILE

	3 Add new GLScrip Function GetListOfUsersGroup(), return an array containing list of user sorted in a specified group
	        Example
			$i=0;
			$ListOfUsers = GetListOfUsersGroup();
			WHILE( $ListOfUsers[$i] != "" )
			        ... Do What you Want ...
			        $i = $i +1;
			ENDWHILE


+-------------------------------+
|Changes from v5.848 to 5.849   |
+-------------------------------+

	1 Add new player var : ontrack
	        getCurrentPlayerVar( "onTrack") equal 1 if player is on track and 0 of not

	2 Add Winner flag on OnResult using new LFS char, limited button
	
	3 Add new GLScript function to save a group to a file
		UserGroupToFile( group, file );
		Example:
			UserGroupToFile( "admin", "./admin.txt" );

	        
+-------------------------------+
|Changes from v5.847 to 5.848   | // 03 November 2009
+-------------------------------+

	1 Add new Event : OnEnterPitLane( $fact )
	        Player Event trigerred when player enter in pit Lane
	        fact can be:
			ENTER		// entered pit lane
			NO_PURPOSE	// entered for no purpose
			DT		// entered for drive-through
			SG		//  entered for stop-go


	2 Add new Event : OnExitPitLane()
	        Player Event trigerred when player exit pit Lane


	3 ( REMOVED REMOVED ) Add a Global Variable $ListOfPlayers[index] containing the list of all the players connectect to the server
	        when you reach the end of this list, return ""
		Example:
			$i=0;
			WHILE( $ListOfPlayers[$i] != "" )
		        	WriteLine( "> " . $i . " - " . $ListOfPlayers[$i] . "<");
	        		$i = $i+1;
			ENDWHILE
		*******************************************************************************
	        PLEASE UPDATE YOUR SCRIPT TO USE THIS FEATURE INSTEAD OF $ar_user FROM PITBOARD
		*******************************************************************************

	4 Add new player var : wr
	        Return the World Record for the current track/Car for the player

	5 Fix bugs in !who script and add the use of the ListOfPlayers
		*******************************************************************************
	        PLEASE UPDATE YOUR SCRIPT TO USE THIS FEATURE INSTEAD OF $ar_user FROM PITBOARD
		*******************************************************************************

	6 Fix bugs in reorder

+-------------------------------+
|Changes from v5.846 to 5.847   | // 1 November 2009
+-------------------------------+

	1 Add $AutoRestartOnFirstFinished = false; config var to determine if the time used
		for the AutoRestartRaceSec value

	2 Add new glscript command to force rotation to next track
	        forceRotation();

	3 Fix bug on result Race
	
	4 Remove array var $ConfVar[idOfVar] replaced by getConfigVar( idOfVar )
	
	5 Add new command setConfigVar( idOfVar, value )
	        You can set some config var in event, list of config var that can be modified

	        adminfile,adminemail,smtpserver,loginmail,passmail,messagetime,showplayercontrol,defaulttopcar,
	        swearwordslist,swearwordsmax,handicapusers,swapside,autogears,shifter,helpbrake,axisclutch,autoclutch,
	        mouse,kbnohelp,kbstabilised,customview,votelifesec,voterestart,votequalify,voteend,autorestartracesec,
	        autorestartonfirstfinished,rotateeverynbraces,enablerotation,rotatetracks,rotatecars,showsplitpb,refreshqualusers,
	        qualusers,maxfloodlines,maxfloodlinestime,maxsessionlaps,minanglevelocity,maxnbinstunt,maxallowedlaptime1,
	        maxallowedlaptime2,onidletimeout1,idleexclude,onidletimeout2,gooddriftscore,minimumdriftscore,minimumdriftspeed,
	        minimumdriftangle,maximumdriftangle,accelerationstartspeed,accelerationendspeed,accelerationstartspeedmph,
	        accelerationendspeedmph,accelerationprivatemaxtime, maxfastdriveonpit,pitwindowstart,pitwindowstop,
		maxcarresets,reordergrid

	6 Add new config Var
	        $ReorderGrid
	        Set the automatic reoder, value can be
	        "WR" reorder relative to World Record
	        "PB" reorder relative to Server Record
	        "LFS" LFS config file reorder
	        
	        you can modify it in setConfigVar


+-------------------------------+
|Changes from v5.845 to 5.846   |
+-------------------------------+

	1 ( Krayy ) Fix bug Reset some Var when race start
	
	2 ( Krayy ) add new GLScript function
		UserIsAdmin($userName);
		Return 1 if true and 0 if false. Use admin.txt file to get admin
		name and add UCID = 0 as admin ( console )

	3  Add $AdminFile in LFSLapper.lpr file to specify what file is used
	for UserIsAdmin function
	
+-------------------------------+
|Changes from v5.844 to 5.845   |
+-------------------------------+
	Add Krayy code

	1 Add 1 lapperVar var
	        raceMins = Race in minute pour timed races
                numConns = Number of player connected
                numPlayers = Number of player on track

	        getLapperVar( "raceMins" );
	        
	2 Add 1 player var
		PitStops = Number of pitstop do by a player
		
		GetCurrentPlayerVar("PitStops");
		or
		GetPlayerVar("NickName","PitStops");
		
	3 Add new GLScritp file "who.lpr". it work with connected.lpr and add
	        a new command for player
	        !who -> display player connected

	4 Add new GLScritp file "handicapper.lpr". it work with connected.lpr
		Allow an admin to assign, save and load handicaps in-race
	        a new command for player and admin
	        !hc -> display player connected


+-------------------------------+
|Changes from v5.843 to 5.844   |
+-------------------------------+
	1. Add Krayy car reset code in LFSLapper
	new events
	        Event OnMaxCarResets() : triggered when MaxCarResets is reached by a player
	        Event OnCarReset() : triggered when player do a car reset

        New param var
	        MaxCarResets = #;
	        # number of allowed car reset before triggering OnMaxCarResets
	
	2 Add 3 lapperVar var
	        RaceLaps = number or laps for a race
	        QalMins = number or minute in a qual
	        racelapsleft = Race lap left before end of race
	        
	        getLapperVar( "RaceLaps" );
	        or
	        getLapperVar( "QalMins" );

	3 Add updated GUI script From Tim

+-------------------------------+
|Changes from v5.842 to 5.843   |
+-------------------------------+
	1. Fix crash when password is to big in config file. Now send an error message

	2. working dir autocreation when a new entry is present in LFSServers.cfg.

	3. Add a new directory "defaultfiles" containing default file for autocreation
	
	4. Fix bug in driftdbs when player have a \0 ( zero ) in nickname

+-------------------------------+
|Changes from v5.841RC to 5.842 |
+-------------------------------+
	1. Add new GLScript function
	  strFormat( formatStr,arg1,..,argn );
	  example:
	    strFormat( "The player {0}, there is actually {1} players on track", GetCurrentPlayerVar("nickName"), GetLapperVar( "nbPlayersOnTrack" ) )
	  
			This function is a very powerfull fonction to format text
			The following table lists format controls supported by the C# String.Format() method together with examples of each control:
			Control	Type	Description	Example
				C	Currency
					Displays number prefixed with the currency simple appropriate to the current locale
					{0:C} of 432.00 outputs $432.00
				D	Decimal
					Displays number in decimal form with optional padding
					{0:D4} of 432 outputs 00432
				E	Exponential
					Displays number in scientific form with optional value for fractional part
					{0:E5} of 432.32 outputs 4.32320E+002
				E	Fixed
					Displays the number including the specified number of decimal digits
					{0:F3} of 432.324343 outputs 432.324
				N	Number
					Converts a number to a human friendly format by inserting commas and rounding to the nearest 100th
					{0:N} of 123432.324343 outputs 123,432.32
				X	Hexadecimal
					Converts a number to hexadecimal
					{0:X} of 432 outputs 1B0
				0:0...	Zero Padding
					Adds zeros to pad argument
					{0:0000.00} of 43.1 outputs 0043.10
				0:0#...	Space Padding
					Adds spaces to pad argument
					{0:####.##} of 43.1 outputs 43.1
				%	Percentage
					Multiplies the argument by 100 and appends a percentage sign
					{0:00.00%} of .432 outputs 43.20%

	2 - Add new GLScript command
	  myConfig();
		This show the Lapper config panel for the player

	3 - Remove shift + I command.

	4 - Add !myconfig in default LFSLapper.lpr file to call the player config panel
	
	5 - Add language bloc translation in config file
	        Syntax :
	        	Lang idLang
	        		...
			EndLang
		You can create many block you want. Many block as you want for Lang "EN".
			idMessage = Message;
			
			idMessage is an idenditification of the message.
			Message is the message displayed on the screen. You can put in it {0} ... {n} parameter. Look at strFormat
			
		Example:
	        Lang "EN"
			main_welc1 = "^7Welcome {0} ^7to ^1LFSLapper ^7powered server !&^2Type ^7!help ^2after leaving garage to see commands.";
			main_welc2 = "^7Your actual friendly Position (all visitors) : ^7{0}&^2Your actual League prequalify Position : {1}^6Estimate Pool : {2}&Don't use swearwords on this server&respect other player&otherwise you can be banned";
			main_accept = "Accept";
		EndLang
	        Lang "EN"
			main_deny = "Deny";
			essai = "My test value 1 = {0}, value 2 = {1}";
		EndLang
		Lang "FR"
			main_welc1 = "^7Bienvenue {0} ^7sur ce serveur Gr par ^1LFSLapper^7!&^2Tapez ^7!help ^2 pour voir les commandes aprs avoir quitt le garage";
			main_welc2 = "^7Votre position absolue (Tous les visiteurs) : ^7{0}&^2Votre position de prqualification : {1}^6Estimation de poule : {2}&Ne pas employer de mots grossiers sur ce serveur&Respecter les autres joueurs&sinon vous risquez d'tre banni";
			main_accept = "Accepter";
			main_deny = "Refuser";
			essai = "Mon essai valeur 1 = {0}, valeur 2 = {1}";
		EndLang
	
	6 - Add new GLScript command
	        GlobalMsg( "Message" );
	        if same as cmdLFS("/msg Message"), but GlobalMsg support automatic translation ( see below )

	7 - Add new GLScript command
	        GlobalRcm( "Message" );
	        if same as cmdLFS("/rcm Message") and cmdLFS("/rcm_all"), but GlobalRcm support automatic translation ( see below )

	8 - Add new GLScript command
	        PrivRcm( "Message" );
	        if same as cmdLFS("/rcm Message") but for the current player, privRcm support automatic translation ( see below )

	9 - Add new GLScript command
		langEngine("%{idMessage}%", param,...,param ) 
		but this function don't return the translated message, but set the translate
		engine for the global messaging. This function must be used everywhere in message function

		example:
			langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual  )
			main_welc2 is defined in language block for the different language
			the value is english is :
				"^7Your actual friendly Position (all visitors) : ^7{0}&^2Your actual League prequalify Position : {1}^6Estimate Pool : {2}&Don't use swearwords on this server&respect other player&otherwise you can be banned"
			in main_welc2 message
				{0} is replaced by value of $Posabs
				{1} is replaced by value of $Posqual
				{2} is replaced by value of $Groupqual
				
	10 - Add new GLScript command
		langTranslate("%{idMessage}%", param,...,param ) same as langTranslate
		but this function return the translated message.
		idMessage , same id who is defined in block message
		param1,..,paramn , parameter to fusion with message. look at strformat

	11 - Add the choice of the lang in the !myconfig command.
	
	12 - Fix minor bug in info when an error occur un script
	
	13 - Fix bug in releasing button when type shift+I
	
	14 - Language pack for EN ( English ) and FR ( French )

			

+--------------------------------+
|Changes from v5.840 to 5.841 RC |
+--------------------------------+
	1. Add new GLScrip command
	        CurrentPlayerlfsWorldPB( $argv );
	        
	        Display a screen table with the lfs world PB for the current player
	        $argv cant contain a car or a track or the two values
	        $argv = "XRT" -> Display all LFS world PB for the XRT Car
	        $argv = "BL1" -> Display all LFS world PB for the BL1 Track
	        $argv = "BL1 XRT" -> Display LFS world PB for the XRT car and BL1 Track
	        
	        This feature need the pubStatIdk setted in config file
	        
	Due to the tarpit that forces you to wait 5 seconds between two call to pubstat
	( if two player join in less than 5 sec the server ), you need to wait few second
	before retry command.

	2. Add new function in LFS chat
	        !mypb to view your LFS world PB

		example:
		        !mypb XRT
		        !mypb BL1
		        

+-------------------------------+
|Changes from v5.838 to 5.840 RC|
+-------------------------------+
	1. Release Candidate

+----------------------------+
|Changes from v5.837 to 5.838|
+----------------------------+

	1. Add Lapper Var : nbPlayersOnTrack
		GetLapperVar( "nbPlayersOnTrack" );

	2. Little optimization: Reload LFSServers.cfg as soon as it's modified
	
	3. Fix Bug on votation if votation end is activated
	
	4. New GLScript function
		GetUserGripPb( username, carName, trackName )
		        example
				GetUserGripPb( "gai-luron, "FBM", "BL1" );
		GetUserDriftPb( username, carName, trackName )
		        example
				GetUserDriftPb( "gai-luron, "FBM", "BL1" );

	5. Now all this player value are in kph and not depending on the player unit
		GetCurrentPlayerVar("Dist");
		GetCurrentPlayerVar("SessDist");
		GetCurrentPlayerVar("AvgSpeed");
		GetCurrentPlayerVar("InstantSpeed");
		GetCurrentPlayerVar("BestSpeed");
		
		To have the result in player unit make a conversion using ToPlayerUnit( valueKph )

	6. Add new GLScriptcommands
		Speed and dist are in kilometer, you need to do convertion in script to display the appropriate value
		ToMph( value ) Convert a value in Mph or Mile
		ToKph( value ) Convert a value in Kph or kilometer
		ToPlayerUnit( value ) Convert a value depending of the player unit choice

	7. Add new player var
		GetCurrentPlayerVar("UnitDist");
		return km if player use this unit
		return Miles if player use this unit


	        
+----------------------------+
|Changes from v5.836 to 5.837|
+----------------------------+

	1. Add GLScript command for User Event
			setUserStoredValue( key, value )
			This function store the value associated with key and username
			You can use this to display a topUser
	2. Add GLScript command for User Event
			getUserStoredValue( key )
			This function retreive the value associated with key and current username
			You can use this to display a topUser

	3. Add GLScript command for User Event.
		topUser( title,key,mode,argv );
		        -> title = Title of the Top displayed
		        -> key = Key used to retreive corresponding values ( limited to 50 characters )
		                ex:
		                        key = "Champ1Race1"; // Display top for the specified race
		                        or
		                        key = "Champ1Race%"; // Display top for the specified Champ
		                                find all value and make a sum by player where key begin with Champ
		                                you can also write it with key = "Champ1%";
					'%' Replace a part of a string in retreiving values
				You can make more complicated structure
				        key="2009Champ1Race1" // Find result for race one in Champ1 in year 2009
				        key="2009Champ1Race%" // Find result for all race in Champ1 in year 2009
				        key="2009Champ%" // Find result for all Champ in year 2009
				        key="%" // All cumulated result


			-> mode = "DESC" or "ASC" Sort sum value descending or ascending
			-> argv = same as Top
	4. Add GLScript command for User Event.
		nearUser( title,key,mode,argv );
		        Same as topUser but list is positionned on current username



+----------------------------+
|Changes from v5.835 to 5.836|
+----------------------------+
	1. Fix concurrent access issue on storedvalue DBS
	
	2. Start with 5 sec between 2 instances in autoworkmode to solve putstat access restriction
	
+----------------------------+
|Changes from v5.834 to 5.835|
+----------------------------+
	1. LFSServers.cfg is scanned every 10 Second to look,if there is a modification
	  You can Add, remove line when Lapper is started.
	  
	2. Start Lapper's instance with the unique ID, not with the line position. No space in ID
		d1|gr1|94.23.7.00|30211|./demo|demo_1.ini|autowork
		d2|gr1|94.23.7.00|30212|./demo|demo_2.ini
		d3|gr1|94.23.7.00|30212|./demo|demo_2.ini

			To start the first instance type
				>start d1

	3. Add new option in LFSServers.cfg
	  	autostart to start lapper's Instance in Stand bye mode
		autowork to start lapper's instance in work mode
		autonone don't start Lapper's instance
		
	4. Fix wrong user in group when LFSLapper's instance crash
	
	5. All messages or errors messages are redirect in log file ( not yet on the console )
	  For LFSLapper
	  	./log/LFSLapper-ERR.log
	    ./log/LFSLapper-MSS.log
	 	For Each instance
			./workingDir/LFSHostIp-port-ERR.log
			./workingDir/LFSHostIp-port-MSS.log
			
		xxx-ERR.log is for error logging
		xxx-MSS.log is for infos logging
		
		Each log file have a limit of +/- 2MB

+----------------------------+
|Changes from v5.833 to 5.834|
+----------------------------+
	1. Fix bug in calculation of average PBtime, where more than one
		PB is used for the final average PB time

	2. Optimize access of hudge Drift DBS. Tested with 1000 entry for one track and one car
	
	3. Completely rewrite votation system. To bee tested accurately
		Event OnVoteQualifyChange($PlayerOnTrack, $Vote , $Need) # New args Vars
		Event OnVoteRestartChange($PlayerOnTrack, $Vote , $Need) # New args Vars
		Event OnVoteEndChange($PlayerOnTrack, $Vote , $Need) # New args Vars


	
+----------------------------+
|Changes from v5.832 to 5.833|
+----------------------------+
	1. You can type in console LFS command who are sended to all LFS instance
		where LFSLapper is in working mode
		example:
		        >/msg Hello everybody to our server
		        >/end
		        >
		        ...
		you can use also
		        >cmdLfs Hello eveybody
		        >cmdLfs /end
		        
	2. Fix Bug on GetHost in C# when the network of the LFS host server
		isn't properly configured ( windows 2003 server )
		using another C# call
		
	3. Add groupID and autostart option in LFSServers.cfg, to start the specified
		instance in stand by mode at LFSLapper start
			#Unique ID|GroupId|Ip|Port|WorkDir|IniFile|autoStart
			DEMO 1|Gr1|94.23.7.62|30211|./demo|demo_1.ini|autoStart
			DEMO 2|Gr1|94.23.7.62|30212|./demo|demo_2.ini
			DEMO 3|Gr2|94.23.7.62|30213|./demo|demo_3.ini
		DEMO 1 is automaticaly started
		
	3. Add new GLscript command
	        groupCmdLfs( cmd );
	        Same command as cmdLfs but send this LFS command to all server having
	        the same group id.
			DEMO 1|Gr1|94.23.7.62|30211|./demo|demo_1.ini|autoStart
			DEMO 2|Gr1|94.23.7.62|30212|./demo|demo_2.ini
			DEMO 3|Gr2|94.23.7.62|30213|./demo|demo_3.ini
		if you are on server DEMO 1 or DEMO 2
		groupCmdLfs("/msg Hello"); display Hello on DEMO 1 and DEMO 2, not on DEMO 3
		if you are on server DEMO 3
		groupCmdLfs("/msg Hello"); display Hello on DEMO 3 not on DEMO 1 and not on DEMO 2

	4. Add !groupCmdLfs in LFSLapper.lpr default file to call
	        groupCmdLfs if you are admin. This add the ability to send command to
		all instance having the same groupID using the LFS chat.

		        
+----------------------------+
|Changes from v5.831 to 5.832|
+----------------------------+
This new version is a test version with managing change to facilitate Lapper installation for
hosting provider like 500Servers.com. The philosophy is one LFSLapper for one or more LFS. Each LFS can have
a working directory containing configuration file and database file. If you want synchronize your's lapper, you need to have
only one Lapper working dir for different LFS server. In this case you use the same database.

	1. Change LFSServers.cfg file
	        Now you have to specify the working dir used by LFSLapper for the managed lfs server
		and the ini file used.
	        one dir can be used for one or more server
		example:
			#    Configuration of LFSServer to be Managed with LFSLapper
			# One line per server
			#Unique ID|Ip|Port|WorkDir|IniFile
			DEMO 1|94.23.7.62|30211|./demo|demo_1.ini
			DEMO 2|94.23.7.62|30212|./demo|demo_2.ini
			
	2. Added ini file containing information needed by LFSLapper to
	        manage one LFS server. this is the content of this file
	        
	        $password = "yourpass"; 		# Password of the managed LFS server
		$configFile = "LFSLapper.lpr";          # Config file used in this server, without password
		$superUsersFile = "superusers.txt";     # File containing user who can stop or start Lapper in LFS, one entry per line
		
		This ini file must be in working directory.

		When you start Lapper, you need to start an instance of Lapper for a specified LFS server like the previous version
		But now this instance is in stand by mode. Waiting command in LFS chat to start Lapper working mode
  		To put Lapper in working mode. Go into LFS and type !start in LFS chat. 
		To put lapper in stand by mode when it is in working mode. type !stop in LFS chat
		
		Each !start reload config file.

	3. new command
	        !status -> Give the Lapper Status
	                stand bye mode
	                working mode
		!start -> To put Lapper in working mode
		!reload -> To reload config file and restart instance
		!stop -> To put Lapper in stand bye mode

	4. When LFS stop, Now Lapper don't crash and try every minute to reconnect to the server in stand by mode
	
	5. Add config var in LFSServers.cfg
		Fix the issue when you start more than one Lapper on same computer

		Remote port is the port used to manage LFSLapper remotely, future extension
		One remote port per LFSLapper on one machine
		Example :
			remotePort=3000;
			
	6. Fix some error when username is not in lowercase -> in top, stats, posabs, etc..
	
	7. Add new GLScript command
	  PrivDelayedCommand( second, callbackfunction );
		Backcall command is executed after second for the current Player ( to use only in player event )
		
	8. New arg for events
		Event OnRaceStart( $NumP ) # Lapper event
		Event OnQualStart( $NumP ) # Lapper event
		
		$NumP = Number of player at the beginning of the race
		
	9. LFSLapper test is the connection pass is wrong and display message on console box
	
	10 - Add new GLScript command
	  RegisterNodeAction( trackname, node, callbackfunction );
		Backcall command is executed when a node is reached by a player
		Example
			RegisterNodeAction( "BL1" , 140 , DisplaySpeed );
			On track BL1, When Node 140 is Reached the Sub DisplaySpped is executed. To have the node of a specified portion of track.
			Go to this place and type !node ( if you are admin ))

+----------------------------+
|Changes from v5.830 to 5.831|
+----------------------------+
	1. Event OnResult now receive the confirm flags
		CONF_MENTIONED		1
		CONF_CONFIRMED		2
		CONF_PENALTY_DT		4
		CONF_PENALTY_SG		8
		CONF_PENALTY_30		16
		CONF_PENALTY_45		32
		CONF_DID_NOT_PIT	64

	2. Fix bug on Import Airio PB file, incorrect format in date
	
	3. Add new trace on crash when creating instance
	
	4. Add new cron entry in task, DayOfWeek
		0 = Sunday
		1 = Monday
		2 = Tuesday
		3 = Wednesday
		4 = Thursday
		5 = Friday
		6 = Saturday
		
		RegisterScheduleAction( "0 0 0 0 * * *", SA_mid );
	       		Do this action only the Sunday at 0:00

	5. Fixed crash on finish Line

+----------------------------+
|Changes from v5.829 to 5.830|
+----------------------------+
	1. Fixed bug on import old PBfile when dat is in english format

	2. Optimize access of hudge grip DBS. Tested with 6600 entry for one track and one car
	
	3. Added new player var for future extension
	  CurrNode -> is the node on the track where the player is, -1 is player is not on track

	4. default script writen by Tim included in this version
	        if you are admin ( look at admin.txt file ), type !gui

	5. Add a default include file addonsused.lpr to set witch addons you want to use

+----------------------------+
|Changes from v5.828 to 5.829|
+----------------------------+
	1. default script writen by Yisc included in this version
			Change track script
			PitBoard script
			PitWindows script
			SafetyCar script

+----------------------------+
|Changes from v5.827 to 5.828|
+----------------------------+
	1.  Add a file config with list of all track avaiable on LFS, with lenght
	
	2. Add new GLScript function
	  GetLongTrackName -> return longtrackname for a specified shorttracname
	  GetLengthTrack  -> return length of track for a specified shorttracname
	  GetGroupTrack -> return group of track for a specified shorttracname
	  GetExtTrack -> return extension for a specified shorttracname

	3. Remove trailing char in button textbox
	
	4. DateFormat used in GetLapperVar( "ShortDate" );
	
	5. Added LongDateFormat to use in GetLapperVar( "LongDate" )
	
	6. UseUsernameForAuthentication Removed from configfile

	7. Add function TextPrivButton( "id_button", "new text"); to change one button text
	    without redrawing or know coordonate of this button
	    
	8. Add new Var to player
	  AuthLevel -> To show the current Level in authorization
	  
	9. Modify parameter on Auth, Add libel Parameter
			$AuthX = "Libel,Carname:Trackname:MinimumTime&Carname:Trackname:MinimumTime&...| Carname:Trackname:MinimumTime&Carname:Trackname:MinimumTime&... | ...";

	10. AuthLevel Function removed
	
	11. OnAuthReached work like it do. Before used in AuthLevel Function



+----------------------------+
|Changes from v5.826 to 5.827|
+----------------------------+

	1. - Fix bugs
		. on command when no parameter are need like !ver etc. crash
		. on Swearword
		. on Fix$RefreshHandicapUsers = true; not working
		. Removed $allow in config file

	2. Change
		cmdLFS("/spec "  . GetCurrentPlayerVar("Nickname") . "^3 allowed on this server");
		to
		cmdLFS("/spec "  . GetCurrentPlayerVar("Nickname") );
		
	3. Idling on track is not active on start race, become active when the first player pass the 1th split

	4. Idling on track is not active after pass finsih line

	5. Add 2 new event
	  OnFinish : trigered when a player finish a race or qualification
	  OnResult - Trigered when result are avaiable after a race or qualification

	6. Added 3 new var setted at end of race or qualification
	  finishedpos : finish or qualify pos (1 = win / 256 = not added to table)
	  racetotaltime : race time (ms) use NumToMsh is need
	  racepbtime : race time (ms) use NumToMsh is need

	7. Change AutoRestartRaceMn to AutoRestartRaceSec
	
	8. Fix error on AutoRestarting when in qualify mode
	
+----------------------------+
|Changes from v5.825 to 5.826|
+----------------------------+
	1 - Add new GLScript command
	  DelayedCommand( second, callbackfunction );
		Backcall command is executed after second

	2 - Register ScheduleAction is obsolete
		new command replace this and can be call everywhere in GLScript to register a schedulet command
		Old Register ScheduleAction are now registered in OnLapperStart
		Example:
		
		Event OnLapperStart()
				RegisterScheduleAction( "* * * * * *", SA_test ); //Scheduled every second
		EndEvent

		Sub SA_test() # Lapper Event
			WriteLine( "Schedule Here");
		EndSub

	3 - Correct type variable returned by fonction in GLScript. Num or Char
	
	4 - Now all command !command are in silent mode
	
	5 - Add new built-in function
	  $var = ToNum( expression ); To force a var to be a numeric var;
	  $var = ToString( expression ); To force a var to be a string var;
	  
	6 - Add include command to include other file into lapper config file
	  example:
	    include "includes/myInc.lpr";


+----------------------------+
|Changes from v5.824 to 5.825|
+----------------------------+
	1 - In timed button, you can put in string text : %txt% To view the countdown in the button
	  example:
			openPrivButton( "clos",78,120,20,10,10,10,32,"Accept(%cpt%)",OnConnectClose );
			
			write a count down button in the screen
					Accept(10)
					Accept(9)
					...
					Accept(0)
			Close the button and do action

	2 - Rename in config file
				qualStartAction -> OnRaceStart
				DriftPBAction -> OnDriftPB
				GoodDriftAction -> OnGoodDrift
				FloodAction -> OnFlood
				AngleVelocityAction -> OnAngleVelocity
				MaxNbInStuntAction -> OnMaxNbInStunt
				DriftLapAction -> OnDriftLap
				DriftTooLowAction -> OnDriftTooLow
				PBAction -> OnPB
				onVoteEndChange -> OnVoteEndChange
				onVoteEndReach -> OnVoteEndReach
				onVoteEndZero -> OnVoteEndZero
				onVoteQualifyChange -> OnVoteQualifyChange
				onVoteQualifyReach -> OnVoteQualifyReach
				onVoteQualifyZero -> OnVoteQualifyZero
				onVoteRestartChange -> OnVoteRestartChange
				onVoteRestartReach -> OnVoteRestartReach
				onVoteRestartZero -> OnVoteRestartZero
				PBQualAction -> OnPBQual
				SwearWordsAction1 -> OnSwearWords1
				SwearWordsAction2 -> OnSwearWords2
				OnIdleAction1 -> OnIdle1
				OnIdleAction2 -> OnIdle2
				LeaveRaceAction -> OnLeaveRace

	3 - OnNewGapPlayerBehind( $split )
			OnNewGapPlayerBefore( $split )
			receive a parameter split who triggered this even
			for the last split, you receive 4
			
	4 - Add new Player var, tyre Coumpound
	    TyreRearLeft
	    TyreRearRight
	    TyreFrontLeft
	    TyreFrontRight
	    
	    This value can change on pit
	      returned values
	      	TYRE_R1
					TYRE_R2
					TYRE_R3
					TYRE_R4
					TYRE_ROAD_SUPER
					TYRE_ROAD_NORMAL
					TYRE_HYBRID
					TYRE_KNOBBLY
					TYRE_NUM
	    
	5 - Add New Event
	    Event OnNewPlayerJoin() : New PLayer joining race or leaving pits ( After Shift + P )
	    
	6 - Add new command in script to manage authorization for group of user
	  	MoveUserToGroup( group, user );
	  	  exemple MoveUserToGroup("Admin","gai-Luron");
	  	  exemple MoveUserToGroup("Admin","gai-Luron,lagamel");
	  	RemoveUserFromGroup( group, user );
	  	  exemple RemoveUserFromGroup("Admin","gai-Luron");
	  	  exemple RemoveUserFromGroup("Admin","gai-Luron,lagamel");
      UserGroupFromFile( group, filepath ) // Clear group and set group with content of file
        exemple UserGroupFromFile( "admin", filepath );
      ClearGroup( group );
        exemple ClearGroup("admin");
      UserInGroup( group, user ) // 1 if true, 0 if false
        exemple :
          	$userName = GetCurrentPlayerVar("UserName");
						IF( UserInGroup( "admin",$userName) == 1 )
						THEN
						...
						ENDIF
			You can create many group as you need!
			
	7 - Add New Event
				Event OnChangeTyres( $FL_Changed, $FR_Changed, $RL_Changed, $RR_Changed )
					$FL_Changed -> Front Left Changed  : 1 Changed 0 No
					$FR_Changed -> Front Right Changed : 1 Changed 0 No
					$RL_Changed -> Rear Left Changed : 1 Changed 0 No
					$RR_Changed -> Rear Right Changed : 1 Changed 0 No
					
	8 - Add new Player var, tyre Coumpound, to compare with new tyres after Pit
	    OldTyreRearLeft
	    OldTyreRearRight
	    OldTyreFrontLeft
	    OldTyreFrontRight

	8 - Add New Event
				Event OnPit( ) // when you are teleported to pit shift+P

	9 - Add new operator in GLScript
	  & = Binary operator and
		| = Binary operator or
		
	10 - All backcalled function from click button receive the clicked button on mouse and special on keyboard
			1		// left click
			2		// right click
			4		// ctrl + click
			8		// shift + click
			
	11 - Add new command openPrivTextButton, to open a button who query an input string
		openPrivTextButton( "ref2",103,140,20,10,10,32,"Caption","Toto",30,saisTxt );
		
			Open a button for the current player, args are
				1 - Unique id for this button
				2 - Left coordinate for this button ( 0-200 )
						$origL = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origL + 5;)
				3 - Top coordinate for this button ( 0-200 )
						$origT = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origT + 5;)
				4 - Width of the button ( 0-200 )
				5 - Heigth of the button ( 0-200 )
				6 - Space between line in multiline button
				7 - Format of the button, look at insim.txt for values
				8 - Caption displayed in the input box
				9 - Button Text
				10 - Number char to be input
				11 - Backcalled sub
				
		12 -  New config Var $StoredValueDbs
		  Set the Name of the database where the stored Lapper Script Value was saved for use in a next restart of Lapper

		13 - New Lapper function :
	 		SetStoredValue( key, value );
	 		  Set a stored dbs value with the key key
				Example:
					$userName = GetCurrentPlayerVar( "UserName" );
					SetStoredValue( $userName . "PITBOARD_POS_X", 12 );
					SetStoredValue( $userName . "PITBOARD_POS_Y", 12 );

	 		getStoredValue( key );
	 		  Return a stored dbs value for a specified key
				Example:
					$userName = GetCurrentPlayerVar( "UserName" );
					$pitBoardX = GetStoredValue( $userName . "PITBOARD_POS_X" );
					$pitBoardY = GetStoredValue( $userName . "PITBOARD_POS_Y" );

+----------------------------+
|Changes from v5.823 to 5.824|
+----------------------------+
	1 - Now drift points are displayed with button

	2 - top and drf now display all lines, even empty, and close previous list before opening new

	3 - Add new command in script language for player event
		closeTop( ); to close the top list
		closeDrf( ); to close the drf list

	4 - Timed button trigger the event function when it close itself
	
	5 - New player var "pos"
	 	GetCurrentPlayerVar("pos") to display the current position of the player
	 	  0 = Unknown
	 	  1 = Leader
	 	  ...
	6 - Add new player var
	  UNameBefore : the username of the player before you in race
	  UNameBehind : the username of the player behind you in race
	  gapBefore : gap between you and the player before you in race
	  gapBehind : gap between you and of the player behind you in race

	7 - Add new event
		Event OnQualStart(); # triggered when qualif start

	8 - Add Events
        Event OnNewGapPlayerBehind() 			// When a new gap are avaiable for player behind you
        Event OnNewGapPlayerBefore()      // When a new gap are avaiable for player before you


+----------------------------+
|Changes from v5.822 to 5.823|
+----------------------------+
	1. Rewrite part of code to have possibility to have one Lapper Who Manage
	  different LFS Server. Less Memory and CPU Usage. Tested with CLR Profiler and
	  .NET Memory Manager to avoid memory Leak
	  LFSLapper.exe configfile1 configfile2 ... configfilen

	2. Sync management removed, because one Lapper can manage different LFS with the Same
	  Dbs. Dbs now work without sync management

	3. Drifting Database now is also managed via sqllite

	4. On console windows, you can use this command
	  -list
		    To list all config file managed and if lapper instance run on it
		- start X
				Start a Lapper instance number X ( X can be view with list )
		- stop X
				Stop a Lapper instance number X
		- quit
			CLose all instances and close Lapper main application

	5 - Optimized catching error in Lapper to have better error message

	6 - Instance of Lapper restart when there is a crash. If 4 restart in little time, then stop
	    the instance. In case of crash you receive a notification via mail each time
	    
	7 - Lapper send a notification via mail when Lapper crash
	  you must configure this values
			$adminEmail = ""; // Where the mail is sended
			$smtpServer = ""; // smtp server used
			$loginMail = "";  // login connection to smtp server
			$passMail = "";   // Pass connection to smtp server
			
	8 - Lapper Monitor the Upload Thread, Web Thread, if die, instance of Lapper stop
	
	9 - Rename in config file
		$Database to $gripDatabase
		
	10 - Add new command in script language
		drfQual( $argv ); to show position of players taking part in the qualifications ( $QualUsers )
		drfNear( $argv ); -> top drift near you
		drfNearQual( $argv ); -> top drift near you of players taking part in the qualifications ( $QualUsers )
		dStatsQual( $argv ) -> View stats of player container in FilterQual variable




+----------------------------+
|Changes from v5.821 to 5.822|
+----------------------------+
	1. Fix bug on event onEndPit

	2. Player Var pitTime now accessible

	3. Fix PBAction Event Code

	4. Fix Parameter wrong on To fast on pit

	5. Fix Parameter wrong on To false Start

	6. Fix CRS Message
	


+----------------------------+
|Changes from v5.820 to 5.821|
+----------------------------+
	1. Fix crash when a new database was generated
	
	2. Fix error when there is no ftp transfer parameters
	
	3. Fix Error on returned value when array are not set
	
	4. Fix Error on BREAK; command
	
	5. Fix error when Lapper Crash. Now Close Properly Thread.
	
	6. Add new command
	  	  SetCurrentPlayerVar(idOfVar,value) # You can't set array var
	  	  To set a player var. This var can be retreive with
	  	  GetCurrentPlayerVar(idOfVar). But you can't change buitin's var like lapdone, username,...

	7. New branch language
	  SWITCH ... CASE ... DEFAULT ... ENDSWITCH
	  
	  Example:
	  SWITCH( $myVar )
	    CASE "value":
	      WriteLine( "I'am here");
	      BREAK;
	    CASE $oneVar:
	      WriteLine( "I'am in this case");
	      BREAK;
		 DEFAULT:
	      WriteLine( "It's default value");
	      BREAK;
	  ENDSWITCH
	  
	8. Add new command termlapper to quit lapper properly
	
	9. Add new command
	  ToUpper( string ) # To uppercase a string
	  ToLower( string ) # To Lowercase a string
	  
	10. New LAPPER.INI to use with PspPad editor
	
	11. Remove /vote=no in Lapper, an old mistake
	
	12. Non Blocking Read TCP or UDP. Fix Timer on Button when no car on track
	
	13. Fix error when using Array in IF FOR etc...
	
	14. Fix Error on SWITCH... CASE ...
	
	
	
+----------------------------+
|Changes from v5.810 to 5.820|
+----------------------------+
	1. Add new built in fonction in GLScript
	  trim( string ) # Remove Trailin space at begin and end of string
	  indexof( string, pattern ) # Search in string the pattern and return index
	  split( string, char, occur ) # split string around Char, occur = wich splitting occurence
	  unset( var ) # To unset a var to reuse it, usefukk to unset array
	  strlen( string ) # Return the size of a string

	2. In script event you can retreive the current player'variables using this function
	  GetCurrentPlayerVar(idOfVar)

	3. In script event you can retreive a player variable using this function
	  GetPlayerVar(username,idOfVar)

	4. Now all time value are numerical val in 1/1000 of second
	
	5. New function
		NumToMSH( num ) # Convert a numerical time value to MSH ( 0.00.10 )

	6. New function
		MSHToNum( string ) # Convert a MSH value ( ex 0.00.10 ) in numerical value

	7. In script event you can retreive a lapper variable using this function
	  GetlLapperVar(idOfVar)

	8. In script event you can access to config var using array ConfVar[idOfVar]
	  exemple : ConfVar["Host"]
	  
+----------------------------+
|Changes from v5.800 to 5.810|
+----------------------------+

	1. Complete rewrite Parser, The script language name is GLScript

	2. Add FOR ... BREAK ... ENDFOR in GLScript
	  example :
	    FOR( $i = 0 ; $ < 10 : $i = $i + 1)
	      Console( $i );
			ENDFOR
	3. Add WHILE ... BREAK ... ENDWHILE in GLScript
	  example :
	    WHILE( $i < 10 )
	      Console( $i );
	      $i = $i + 1;
			ENDWHILE
	4. Add Multidimensinal Array in GLScript
	  example
	  	$i[1] = 1;
	  	$i[2] = 2;
	  	FOR( int $j = 1; $j < 3 ; $j = $j + 1 )
				Console( $i[$j] );
	  	ENDFOR
	 5. Add Builtin function
	    string subStr( "string", start [,nbofcar] )
	    this function return a substring of the original string starting at start. nbofcar is optionnal

	    examples:
	    	$orig = "Voici un test";
				$toto = subStr( $orig, 6, 7 ) . " " . subStr( $orig, 0, 5 ); # return "un test Voici"
				$tata = subStr( "Voici un test", 9 ) . " " . subStr( "Voici un test", 0, 5 ); # return "test Voici"


+----------------------------+
|Changes from v5.716 to 5.800|
+----------------------------+
	1. Use of sqlite database instead of txt file to minimize memory usage
	  to convert old txt file, remove .txt extension in config file
	  in $Database
	  
	  exemple, if your PB file is named PB.txt
	  change
	  $Database = "./PB.txt";
	  to
	  $Database = "./PB";
	  Launch Lapper and it will be create sqlite database with your old data

	2. Export file have now .elp ( export lapper ) extension, not txt

	3. Export file have now a new header with version in it
	
	4. Add new config var
			$LapTimeUsedForPb = 1; # How many PB lap used to make average PB time, Min = 1 and Max = 10

	5. Removed confid var
	  $TimeFormat
	  
	
+----------------------------+
|Changes from v5.715 to 5.716|
+----------------------------+
	1. Fix bug on var handicap

+----------------------------+
|Changes from v5.714 to 5.715|
+----------------------------+
	1. Fix Bug when synchro of multiple PB instance in the same directory
	
	2. Fix conversion float to string in parser eval "=="
	
	3. Add new var
		$LapsDone           -> Lap done for the current player

	4. Add new config var and event
		$PitWindowStart=2; -> Begin allowed pit start at this lap ( included )
		$PitWindowStop=4;   -> End allowed pit finish at this lap ( included )
		
		Event OnNotPitWindow() -> Triggered when a play do a pit on not allowed window
		Event OnBeginPitWindow() -> Triggered when a player enter in the pit window allowed lap
		Event OnEndPitWindow() -> Triggered when a player exit off the pit window allowed lap
		
 5. Fix HandicapUsers issue when you want use a file
 
 


	
+----------------------------+
|Changes from v5.713 to 5.714|
+----------------------------+
	1. Add PlayerVar ident to define var that are player variable and visible on each event .
	  Event OnLapperStart()
	  	PlayerVar $myvar = 12;
	  EndEvent
	  
	  This var now it's visible in all player event and can be used or changed. All modification are visible
	  on other player event for current player.	
	
	 2. Add new event : 
	 	OnRotateCar -> When car is changed on rotation
	 	OnRotateTrack -> When track is changed on rotation
	 	
	 3. Suppress message "car changed go to pit". You must do in in correct Rotate Event
	 	
	 4. Add new built-in vars
	 	$CurrRotateCar -> Current rotated Car
	 	$CurrRotateTrack -> Current rotated Track
		CurrLongRotateTrack -> Current rotated Track
	 	$NextRotateCar -> Next rotated Car
	 	$NextRotateTrack -> Next rotated Track
	 	$NextLongRotateTrack -> Next rotated Track
	 	
	 	

	+----------------------------+
|Changes from v5.712 to 5.713|
+----------------------------+
	1. Flags players for current player tested also when on track and changed( mouse,view,...,etc)
	
	2. Add new event : OnLapperStart
	  this event is triggereg when lapper start
	  
	3. Add GlobalVar ident to define var that are global and visible on each event.
	  Event OnLapperStart()
	  	GlobalVar $myvar;
	  
	  	$myvar = "it's a test";
	  EndEvent
	  
	  This var now it's visible in all event and can be used or changed. All modification are visible
	  on other event.
	  

+----------------------------+
|Changes from v5.711 to 5.712|
+----------------------------+
1. Fix EnterPitAction

2. Fix Idling when in pit ( teleported  shift+P )

3. Fix center text in button under certain condition

4. You can call a sub or event in other event, be carrefully do not do an infinite Loop

5. Fix Swearword count

6. Remove warning messages on PENR_UNKNOWN

7. Remove warning "Sub '' not found in your config file"

8. $RotateTracks and $RotateCars are independent
	if $RotateCars = "" or RotateCars = "Onecar" , rotate only on track and current car
	if $RotateTrack = "" or $RotateTrack = "Onetrack", rotate only on car and this track or current track
	
9. Correct bug on test time value


+----------------------------+
|Changes from v5.710 to 5.711|
+----------------------------+
1. Fix username issue for kick/ban/spec in demo host

+----------------------------+
|Changes from v5.706 to 5.710|
+----------------------------+
1. AvgSpeed is allowed in all player event

2. Fix $allow regression

3. Allow && ( and ), || ( or ) in expression
	example:
		IF( $var > 2 && $var < 5 ) THEN
		  ...
		ENDIF
4. Add new Var
	$HostName -> Current host Name

+----------------------------+
|Changes from v5.706 to 5.707|
+----------------------------+
1. Add new var
	$isBestSectorSplit1 -> 1 if this sector split is best than previous Best, otherwise 0
	$isBestSectorSplit2 -> 1 if this sector split is best than previous Best, otherwise 0
	$isBestSectorSplit3 -> 1 if this sector split is best than previous Best, otherwise 0
	$isBestSectorSplitLast -> 1 if this sector split is best than previous Best, otherwise 0

2. Remove var
	$CurSplit         	-> Split duration for the last sector
	$BestSplit        	-> Best Split duration for the last sector
	$DiffSplit        	-> CurSplit - BestSplit
	$BestSPB		-> is the last sector is best than previous Best
	$SplitNumber		-> Split number

3. Remove event
	OnSpbSplit

4. Add event
	OnSpbSplit1		-> Event triggered when sector split is done and showsplit on config player is true
	OnSpbSplit2		-> Event triggered when sector split is done and showsplit on config player is true
	OnSpbSplit3		-> Event triggered when sector split is done and showsplit on config player is true
	OnSpbSplitLast		-> Event triggered when sector split is done and showsplit on config player is true

5. Add Var
	$PBLapTime		-> Current PB on current Combo
	$diffLapTimeToPb	-> Laptime - PBLTime

6. Now +-/* work also on time value
	example
		"0.10.10" + "0.01.20" = "0.11.30".

7. Fix disconnection when request button sended to fast to host ( LFS bug )

8. Add event
	OnSplit1		-> Event triggered when sector split is done
	OnSplit2		-> Event triggered when sector split is done
	OnSplit3		-> Event triggered when sector split is done
	OnLap			-> Event triggered when sector split is done

+----------------------------+
|Changes from v5.705 to 5.706|
+----------------------------+

1. Add new var
	$SectorSplit1       -> Last First sector Split, updated when doing new Split1
	$SectorSplit2       -> Last second sector Split, erased when doing Split1
	$SectorSplit3       -> Last third sector Split, erased when doing Split1
	$SectorSplitLast    -> Last Last sector Split, erased when doing Split1

	$SectorBestSplit1   -> Best Split duration for the sector 1
	$SectorBestSplit2   -> Best Split duration for the sector 2
	$SectorBestSplit3   -> Best Split duration for the sector 3
	$SectorBestSplitLast-> BestSplit duration for the last sector

	$DiffSectorSplit1       -> $SectorSplit1 - $SectorBestSplit1
	$DiffSectorSplit2       -> $SectorSplit2 - $SectorBestSplit2
	$DiffSectorSplit3       -> $SectorSplit3 - $SectorBestSplit3
	$DiffSectorSplitLast    -> $SectorSplitLast - $SectorBestSplitLast

+----------------------------+
|Changes from v5.704 to 5.705|
+----------------------------+

1. Add new var
	$Split1             -> Last First Split, updated when doing new Split1
	$Split2             -> Last second Split, erased when doing Split1
	$Split3             -> Last Third Split, erased when doing Split1
	$LapTime           -> Current Lap Time, erased when doing new LapTime

2. New script command
	console( string_text );
	output Text to console windows ( for debugging script )

3. Fix $LongTrackName and $ShortTrackName not displayed

+----------------------------+
|Changes from v5.703 to 5.704|
+----------------------------+

1. Fix wrong decimal value in driftscore.

2. Many modification and Upgrade in expression evaluator
	operator allowed:
		+,-,/,*,^,==,!=,>,<,<=,>=
3. You can use IF( expr ) THEN ... ELSE ... ENDIF in script, take a look on onSpbSplit for an averview
	Exemple if you want kick unnamed on OnConnectClose Sub called when player click Accept
	Sub OnConnectClose()
		closePrivButton("welc&pos&clos&ref");
		IF( $Nickname == "unnamed" )
		THEN
			cmdLFS( "/kick " . $Username );
		ENDIF
	EndSub
	You can also test this when a player join a race


4. Event removed in config file:
                OnSpb1Up
                OnSpb1Low
                OnSpb2Up
                OnSpb2Low
                OnSpb3Up
                OnSpb3Low
                OnSpbLastUp
                OnSpbLastLow

5. New Event in config file
        OnSpbSplit When a split is done
        OnSpbLast When a lap is done

6. Remove turn off button when spectated

7. Add config version file from Yisc[NL]

8. New color syntax file for PSPPAD editor in doc folder



+----------------------------+
|Changes from v5.702 to 5.703|
+----------------------------+

1. Fix wrong value for acceleration Time display in Acceleration options.

2. Corrected config file by Yisc[NL]

3. Fix issue when wr not present on lfs world or not loaded

+----------------------------+
|Changes from v5.701 to 5.702|
+----------------------------+

1. Fix issue when config file is in utf-8 format. This file must be in UTF-8 or ansi
	solve somme bug on autokick, and $allow


+----------------------------+
|Changes from v5.700 to 5.701|
+----------------------------+

1. Idle Time out wrong Unit in config file, now second

2. Laptime and averagespeed (unknown) when new PB

3. Car can be put in lower or uppercase in !top

4. Corrected config file



+----------------------------+
|Changes from v5.641 to 5.700|
+----------------------------+
1. Change config file, new version, it's more easy to create and read

2. Change in trackinfo file for the split actions. Now split action reference to sub in config file

3. You can search specific user with !nearqual and !near
		without arg, you can view you nearqual position
		with arg you can view nearqual position for a player
		  arg can be a partial name !nearqual gai-lu

+----------------------------+
|Changes from v5.640 to 5.641|
+----------------------------+
1. Fix bug on button

2. Fix bug on OnIdleTimeout1 et OnIdleTimeout2. Now in second

+----------------------------+
|Changes from v5.632 to 5.640|
+----------------------------+
1. Change in interval configuration management ( for future extension ))
  AuthPrivMess : removed
  OnAuthReached : Added to replace AuthPrivMess
  
2. Fix bug in /http commands

3. Add switch in command Line
	-help -> Show command line parameter
	-debug -> put LFSLapper in debug mode
	-dumpvar -> Dump all variable used by LFSLapper and set by config file
	
4. Add Var IdleExclude. User to exclude to idle action. Only username, no nickname
	because in future version all player were registered
	Exemple :
		IdleExclude = Lagamel,Gai-Luron;
		
5. Remove Var, this var are obsolete
        AutoAction
        AutoMsgPrivate

6. New config ability : addCmd to add a new command to lapper

 Action to do on special command typed in message line
 Syntax
     addCmd( "command[|command]"[,"allowedUser"]) = command text

 "allowedUser" is optional if you wish to specify users, that are allowed to execute action
 You can specify more user separated by '|'
   Exemple  :
     addCmd("!ver","Gai-Luron|Lagamel") = /ver;
 If ! before a name, force nickName authentification if UseUsernameForAuthentication=true
 If ! before a name, force userName authentification if UseUsernameForAuthentication=false
 You can use regexp expression in userName pattern, type regex=your regular expression
			Exemple : if UseUsernameForAuthentication=treu
				!regex=^\[COP\].*
				Find all user who nickname begin with [COP]
				regex=^Gai.*
				Find all user who username begin with Gai
 		See regular expression on web for more info how it work
 Use & sign at end of patterns, if you wish to specify a file containing users, that are allowed to execute action. users separate by \n

 Use & sign at beginning of "allowedUser", if you wish to specify a file containing users, that are allowed to execute action. users separate by \n
   Exemple  :
     addCmd("!ver","&./cmd.flt") = /ver:
     
7. Add internal var for config file. A local variable can be defined to put in another configration variable
	To define a var
		<myVar> = /pm i'm very happy;

	You can include this local variable in configuration variable
		PBAction = /msg New PB by {Nickname}^8|<myVar>;

	In fine PBAction look like this for LFSLapper
		PBAction = /msg New PB by {Nickname}^8|/pm i'm very happy;
	



  
+----------------------------+
|Changes from v5.632 to 5.633|
+----------------------------+
1. Remove LapperAdminVote, obsolete
	if VoteRestart or VoteQualify or VoteEnd = -1, not catched by LFSLapper

2. Add some vote variables
 VoteLifeSec = Second for the life for a vote

	VoteRestart = percent of player vote on track need to restart race, LFS admin this if set to -1
	onVoteRestartChange = Command to do when player vote to restart
	onVoteRestartReach = Command to execute when VoteRestart is reached
	onVoteRestartZero = Command to execute when no nb of player reach zero

  VoteQualify = percent of player vote on track need to qualify, LFS admin this if set to -1
  onVoteQualifyChange = same as restart but for qualify
  onVoteQualifyReach = same as restart but for qualify
  onVoteQualifyZero = same as restart but for qualify

  VoteEnd = percent of player vote on track need to end race, LFS admin this if set to -1
  onVoteEndChange = same as restart but for qualify
  onVoteEndReach = same as restart but for qualify
  onVoteEndyZero = same as restart but for qualify

On this action you can use:
 	{Nickname} - Nickname of driver
 	{Username} - Username of driver
 	{Vote} - Player who have voted
 	{Remain} - Player remaining to vote
 	{Need} - Player needed for action

	
3. Add date and time format in cfg file
	 Date and time format for PB file

	 Look at C# format date, little help

	 HH = Hour in 0-23 format
	 hh = Hour in 0-12 format
	 mm = Minute
	 tt = PM or AM
	 dd = Day of the month
	 MM = Month
	 yyyy = year with 4 digits

	Exemple
		DateFormat = dd/MM/yyyy;
		TimeFormat = HH:mm;


+----------------------------+
|Changes from v5.631 to 5.632|
+----------------------------+

1. Add Lapper administration for vote
	LapperAdminVote = false; if set to true, Lapper admin all votes
	VoteRestart = 75; players percent needed to act this vote, host not include
	VoteQualify = 75; players percent needed to act this vote, host not include
	VoteEnd = 75;     players percent needed to act this vote, host not include
	
	VoteLifeSec = 30; Life in second for a vote

+----------------------------+
|Changes from v5.62 to 5.631 |
+----------------------------+
1. Add InRaceLapsVoteMinMax = Laps between Vote are allowed on race
	Exemple:
		InRaceLapsVoteMinMax = 0-0 Vote are never allowed
		InRaceLapsVoteMinMax = -5 Vote allowed between first lap and 5 lap
		InRaceLapsVoteMinMax = 2- Vote allowed between laps 2 and end of race
		InRaceLapsVoteMinMax = - Vote always allowed

2. Add {Username} var in trackinfo.cfg

3. Add AutoRestartRaceMn = Minute between End of a race and an automatic restart
 	AutoRestartRaceMn = 0; No restart

4. Add Automatic rotation for car and or track 
	Rotation work only if AutoRestartRaceMn is set

	EnableRotation = Allow or diallow rotation for track and/or car
		Values : true or false
	RotateTracks = track to rotate separated by ','
	RotateCars = cars to rotate separated by ',' Use LFS definition for car. , if not set, no car rotation
	RotateEveryNbRaces = Number of race to do before rotation


		

+---------------------------+
|Changes from v5.62 to 5.63 |
+---------------------------+
1. Check for bad words or swearwords
	SwearWordsList : 	is a list of bad words
 						- if you prefix with & , You can indicate a file name who contain list of swearWords, one word per line
 						- if you do not prefix, You can list word separated with ,
	Syntax :
		SwearWordsList = &./your_file;
		or
		SwearWordsList = word1,word2,...,wordn;

	SwearWordsMax : Max allowed bad words / session
	SwearWordsAction1 : 	is an action to do when user write bad words before reach SwearWordsMax
	SwearWordsAction2 : 	is an action to do when user write bad words when reach SwearWordsMax

	Variable avaiable on SwearWordsAction1 and SwearWordsAction2
		{Nickname} - Nickname of driver
 		{Username} - Username of driver
 		{SwearWordsMax} = Max allowed swearwords
 		{SwearWordsRem} = Remaining retry before SwearWordsAction2

2. Remove gcbut, deprecated

3. Add to pbut one argument. this is a line command Lapper Do when you click on this button.
	this command line must be quoted.
	/pbut id,ids_to_close,L,T,W,H,I,Time,one line message,"command"

4. /cpbut is now a Lapper command to close one Button.
	/cpbut id_buttontoclose&...&id_lastbuttonto close

+---------------------------+
|Changes from v5.61 to 5.62 |
+---------------------------+

1. Change line separation in message button form  to &. Bug on coding into some system character coding

2. Change command cbut in cpbut.

3. Add gbut command to display a global message to all players, 

4. Add gcbut command to put a close button for all player



+---------------------------+
|Changes from v5.60 to 5.61 |
+---------------------------+

1. !topqual, !nearqual, !top, !near, !help now are displayed on Message Box

2. Add new internal command : /cpbut
	to put a button to close one or more personnal message button, only one line in text parameter
Syntax :
	/cpbut id,ids_to_close,L,T,W,H,I,Time,one line message,"command"
	
	id = string id for the button
	ids_to_close = ids buttons of all messages button separated by &
	L = Left coordonate ( 0 to 200 )
	T = Top coordonate ( 0 to 200 )
	W = Width for the button ( 0 to 200 )
	H = Heigth for the button ( 0 to 200 )
	I = Separation bettween multi line message ( 0 to 200 )
	Time = Is the time in second that the button is displayed, -1 not closed and closed on click.
	Bstyle = Button style, look at insim.txt for value or below
	"command" = is a quoted list of Lapper command


+---------------------------+
|Changes from v5.54 to 5.60 |
+---------------------------+
1. Add some variables in AutoMsgPrivate var in config file {Posabs} {Posqual} {Groupqual} to display then in some case

2. New command /termlapper to close lapper in command line or scheduled action. Usefull for end pre-qualification

3. Add new internal command : /pbut
	to display a private message button, each line for message are separated by &
Syntax :
	/pbut id,L,T,W,H,I,Time,message line1&message line1&...&Message line n
	
	id = string id for the button
	L = Left coordonate ( 0 to 200 )
	T = Top coordonate ( 0 to 200 )
	W = Width for the button ( 0 to 200 )
	H = Heigth for the button ( 0 to 200 )
	I = Separation bettween multi line message ( 0 to 200 )
	Time = Is the time in second that the button is displayed, -1 not closed
	Bstyle = Button style, look at insim.txt for value or below

// BStyle byte : style flags for the button

#define ISB_C1			1		// you can choose a standard
#define ISB_C2			2		// interface colour using
#define ISB_C4			4		// these 3 lowest bits - see below
#define ISB_CLICK		8		// click this button to send IS_BTC
#define ISB_LIGHT		16		// light button
#define ISB_DARK		32		// dark button
#define ISB_LEFT		64		// align text to left
#define ISB_RIGHT		128		// align text to right

32+64 = 86
Exemple:
	If you set Bstyle = 86 your text is in dark button and align to left.

// colour 0 : light grey		(not user editable)
// colour 1 : title colour		(default:yellow)
// colour 2 : unselected text	(default:black)
// colour 3 : selected text		(default:white)
// colour 4 : ok				(default:green)
// colour 5 : cancel			(default:red)
// colour 6 : text string		(default:pale blue)
// colour 7 : unavailable		(default:grey)


+---------------------------+
|Changes from v5.53 to 5.54 |
+---------------------------+
1.	Add ability to select multi car in DefaultTopCar
		you can specify one or more car with "+" between car
		Ex : DefaultTopCar=XFG+XRG

		TBO    - same as XRT+RB4+FXO
		LRF    - same as LX6+RAC+FZ5
		GTR    - same as FXR+XRR+FZR

2.	You can use multi car in !top, !near, !topqual, !nearqual

3.	You can specify witch car is used by a user in QualUsers adding car after username separated by : 
		Example :  Gai-Luron:XFR,lagamel:UFR
		work also in qualusers file. 
		Don't forget to set DefaultTopCar in accordance with all car used in qualify session

4.	Fix Bug on dstats


+---------------------------+
|Changes from v5.52 to 5.53 |
+---------------------------+
1.	Fix Bug with mono

+---------------------------+
|Changes from v5.51 to 5.52 |
+---------------------------+
1.	?????, i don't remember

+---------------------------+
|Changes from v5.50 to 5.51 |
+---------------------------+

1.  Minor change in how work Handicap. Now 3 levels for handicap
		You can specify 3 level of handicap : for car, for car and track, for user
		Priority Level low to hight : HandicapCars, HandicapCarsTracks, HandicapUser.
		Prior the handicap are added, not now
	
	Priority to HandicapUser if exist, next HandicapCarsTracks if exist finally HandicapCars
	
	New var HandicapCarsTracks
		Syntax :
		HandicapCarsTracks = car/track:mass:irest,car/track:mass:irest,...,car/track:mass:irest;

2.  Now in AuthAllowPlayer you can specify also player allowed to access to track.
	Syntax:
		AuthAllowPlayer=Auth1|...|AuthX|@username1,username2,...,usernameN;

3.  Modification in Web register. Now it send LFSLapper's version.

4.  Registered page web modified with new infos.
		look at www.frh-team.net/reglapper

+---------------------------+
|Changes from v5.43 to 5.50 |
+---------------------------+

1. Fix Bug in Qualusers when you use a txt file. Defgroup:2:30:2 now work

2. New powerfull command

	/http url ( look at !powered in config file )

	- with this command you can query to a web the list of command to be execute when action containing /http 
	is triggered.

	- The web page can't contain HTML code but only LFSLapper command separate by | ( Like config file ).

		example: http://www.frh-team.net/reglapper/getserver.php 
				is a web page that return the number of Lapper up!
			The web page print only :
				/pm ^7Actually, there are ^335^7 LFSLapper powered servers

	- you can call your web page with Lapper's arguments ( like nickname, username depending on action trigered using php
	sending parameter ). Then your page return a set of command.

	- it is a powerfull command for guy knowing php programming.

	- This command run asynchronously with Lapper and may be take a while depending response of your web site
	i put a 5s timeout for slow web server, tell me if it's to short.

	- An http command don't block LFSLapper, it continue to run normally. When response is availlable, LFSLapper 
	execute the web response.



+---------------------------+
|Changes from v5.42 to 5.43 |
+---------------------------+

1. Allow or Disallow join Race relative to Flags for current the player,
	Racer flags													
		Y = Yes														
		N = No														
		* = Yes or No													

	SwapSide = *;
	AutoGears = *;
	Shifter = *;
	HelpBrake = *;
	AxisClutch = *;
	AutoClutch = *;
	Mouse = *;
	KbNoHelp = *;
	KbStabilised = *;
	CustomView = *;

	New
		OnNotMatchFlags action
		
		new vars 
			{PlayerFlags} = The current Player flags
			{RequiredFlags} = The current Required flags


+--------------------------+
|Changes from v5.41 to 5.42|
+--------------------------+

1. Fixes issue in automessage et autoaction


+--------------------------+
+--------------------------+
|Changes from v5.40 to 5.41|
+--------------------------+

1.	New penalties work
	OnFastDriveOnPitL1 = Actions on 30 Sec Penalty or drive-through
	OnFastDriveOnPitL2 = Actions on 45 Sec Penalty or Stop&Go
	MaxFastDriveOnPit = Max Fast Drive on Pit allowed per race
	OnMaxFastDriveOnPit = Actions on Max Fast Drive on Pit allowed
	OnFalseStartL1 = 30 Sec Penalty or drive-through
	OnFalseStartL2 = 45 Sec Penalty or Stop&Go
	
	Obsolete parameters
		MaxDriveThroughPenalties
		StopGoPenaltyAction
		MaxStopGoPenalties
		Time30PenaltyAction
		Time45PenaltyAction
2. New feature : execute an action whenever a user drives more laps in a single session than allowed
	New config vars:
		MaxSessionLaps = Number;
		OnMaxSessionLaps = Action;
	Add new var in onConnect action
		{MaxSessionLaps} -> Max laps allowed per session
		
3. You can Register your lfs name server on FRH TEAM WEB Server( Only name Server is transmitted look at RegisterWeb.cs )
	Soon ability to display the name server list Running Lapper on frh-team server
	This allow user to know where are server running Lapper and connect to them
	New config vars:
		EnableRegisterWeb = true;
		
4.	New command for command line to allow or no authorization mode
	/license on
	/license off
	/license ? 
	
	New command for text input in LFS
	!license on
	!license off
	!license ? 
5.	Add Minimum player config
 	this enable Authorization. if less: All player allowed, if upper: AuthAllowPlayer only allowed
	AuthMinPlayer = 0;



	
+--------------------------+
|Changes from v5.32 to 5.40|
+--------------------------+

1.	Reorganization in config file, some explications added. some : replaced with {colon}   (thank's Yisc[NL])
2.	Car Handicap mass and intake restriction added
3.	!hand command modified
	without argument show your required handicap and your actually configured handicap for you and car
	with username argument: Show required handicap for a specified user and current car
4. Add on var OnConnect: 
	{Nickname} - Nickname of driver
	{Username} - Username of driver
5.	Add new command in action
	/pm message - This command send a private message to player who generate this action
	some var is not bee continued because you can put private message on action
	I remove this var from config, but for compatibility, now you can continue to use it, 
	but please remove it at son as possible and add this var with command /pm in action
	Var concerned:
		ConnectMsg -> put values in OnConnect with /pm command
		PrivateMessageOnDriftScore -> put values in OnDriftScore with /pm command
		AccelerationPrivateMessage -> put values in OnAcceleration with /pm command
		BeginPitPrivMess -> put values in OnBeginPit with /pm command
		EndPitPrivMess -> put values in OnEndPit with /pm command
		PrivMessSpb1Up -> put values in OnSpb1Up with /pm command
		PrivMessSpb2Up -> put values in OnSpb2Up with /pm command
		PrivMessSpb3Up -> put values in OnSpb3Up with /pm command
		PrivMessSpb1Low -> put values in OnSpb1Low with /pm command
		PrivMessSpb2Low -> put values in OnSpb2Low with /pm command
		PrivMessSpb3Low -> put values in OnSpb3Low with /pm command
		PrivMessSpbLastUp -> put values in OnSpbLastUp with /pm command
		PrivMessSpbLastLow -> put values in OnSpbLastUp with /pm command
		
6.	You can use special command in action line
	/pm
	/cleanspb
	/spb
	/statsqual
	/stats
	/hand
	/dstats
	/ver
	/nearqual
	/near
	/drf
	/topqual
	/top
	/auth
	
7.	Add parameter for player to slow to accomplish a lap, this is relative to Maxlaptime from trackinfo.cfg
	2 Level
		MaxAllowedTime1 = % Max allowed time to complete a lap relative to MaxLapTime on trackInfo.cfg
			MaxAllowedTime1 = 100 # 100% of MaxLapTime
		MaxAllowedTime2 = % Max allowed time to complete a lap relative to MaxLapTime on trackInfo.cfg
			MaxAllowedTime2 = 150 # 100% of MaxLapTime

		OnMaxAllowedLapTime1 = Action To do when to Slow level 1
		OnMaxAllowedLapTime2 = Action To do when to Slow level 2

8.	Exclude a pitstop from the idle-check

9.	OnDisConnect action added

10.	New vars on AutoMsgPrivate
	{Dist} - Distance on current car and track
	{SessDist} - Distance on current car and track for session
	{UnitDist} - Unit for distance
	
	And New command
	
	!distance

			
+--------------------------+
|Changes from v5.31 to 5.32|
+--------------------------+

1. 	Use in !top and !near the last car used by player requesting this info. If no last car ( player joining ) use of defalutTopCar
	from the config file
2.	In autoaction add a switch !
	If ! before a name, force nickName authentification if UseUsernameForAuthentication=true
	If ! before a name, force userName authentification if UseUsernameForAuthentication=false
3.	In AutoAction, you can use regexp expression in user pattern, type regex=your regular expression instead of user name
			Exemple : if UseUsernameForAuthentication=true
				!regex=^\[COP\].*
				Find all user who nickname begin with [COP]
				regex=^Gai.*
				Find all user who username begin with Gai
 		See regular expression on web for more info how it work


+--------------------------+
|Changes from v5.30 to 5.31|
+--------------------------+

1. *** WARNING *** Configuration file is changed
	the terminator of each line is ";" now.
	I remove 'Tab' obligation for multiline command
	To avoid to retype all yours configs files, i do an Utility ConvCfg.exe to reconstruct all cfg file in directory where you launch ConfCfg.exe
2. Add 10 levels authorisation for access server relative to time do by user on Car/Track 
	( Automatised license management for two or more server with Sync PB Lapper feature )
	You can have one serveur for all Player, the second server with PB file synchronized 
	with the first and allows only user who have made a good PB on the first server
3. Add parameter in config file for this feature
	Auth1 = XFG:BL1:1.30.10	| XRT:SO4:1.20.20;
	Auth2 =	XFG:BL1:1.10.10	| XRT:SO4:1.20.20;
	Auth3 =	...;
	...
	Auth10 = ...;

	AuthAllowPlayer = Auth1|Auth2|...|AuthX;
	OnAuthAllowed = /msg {Nickname}^3 allowed on this server;
	OnAuthNotAllowed = /spec {Nickname}|
					/msg {Nickname}^3 not allowed on this Server|				
	;
	AuthPrivMess=^3You have got level {auth};		SyncID = Sync Unique ID for this Lapper
4. Add New command : /auth to know your level authorization on this server

+--------------------------+
|Changes from v5.20 to 5.30|
+--------------------------+

1. Add ability to sync PB.txt for 2 or more Lapper
2. Add parameter in config file
		SyncID = Sync Unique ID for this Lapper
		SyncDir = Sync Directory name for Synchronization, all Lappers to be Synchronized must have same Directory
		SyncIDsToSync = All Lappers ID To synchronize with you, you can't put here your current Sync Unique ID

+--------------------------+
|Changes from v5.15 to 5.20|
+--------------------------+

1. Compatibily with patch Y
2. Add FBM Car
3. Add SO6 Track

+--------------------------+
|Changes from v5.13 to 5.14|
+--------------------------+

1. Add variable {*} in AutoAction who is the rest of the line racer type in ( argument ).
	!ban@VANE|/ban {*}

+--------------------------+
|Changes from v5.12 to 5.13|
+--------------------------+

1. Fix stats bug and dstats bug

2. Add fields in trackinfo.cfg 
       -  lapTimeAction ( Action to do when a player to a specified time Lap )
       -  lapTime ( Time to trigger action )

+--------------------------+
|Changes from v5.11 to 5.12|
+--------------------------+

1. Fix PB bug when change track without restart LFSLapper

2. Fix display Bug of Unit Speed when do a new PB server

+--------------------------+
|Changes from v5.10 to 5.11|
+--------------------------+

1. LFSLapper Save Config of each Player in shift + i mode

2. Now Player can do the choice of display Speed Unit in config screen ( Shift + i )

3. Add Variable {UnitSpeed} to display the speed Unit of the racer in cfg file

4. Add variable to test acceleration for racer who have Mph unit. Now acceleration can be calculated for kmh racer and mph racer
	AccelerationStartSpeedMph ( in Mph )
	AccelerationEndSpeedMph  ( in Mph )
	
5. Fix bug of display product info in LFSLapper Screen	
	
+--------------------------+
|Changes from v5.01 to 5.10|
+--------------------------+

1. Add TCP connection to Insim ( Add a parameter in cfg file if you want disable and use UDP )

2. Add the test of the format time in trackInfo.cfg

3. Add {LongTrackName} variable in cfg file

4. Now old Lapper built-in command (!ver,!top,... ) can be put on private messages in the cfg file
	/ver -> Show version of LFSLapper
	/cleanspb -> Clean your current session of Spb
	/spb -> Show your SPB
	/hand -> Show your handicap or a player handicap
	/statsqual -> View stats of player container in FilterQual variable
	/dstats -> Drift Stats
	/stats -> Stats of a player
	/nearqual -> Top qual near your position if you are in FilterQual variable
	/near -> Top near you
	/topqual -> Top qual of player in FilterQual variable
	/top -> Top 
	/drf -> Drift Top
	
5. Add command in AutoMsgPrivate, copy this commands in this place or use new cfg file
AutoMsgPrivate =
	!ver|/ver|
	!cleanspb:!razspb|/cleanspb|
	!spb|/spb|
	!hand|/hand {*}|
	!statsqual|/statsqual {*}|
	!dstats|/dstats {*}|
	!stats|/stats {*}|
	!nearqual|/nearqual {*}|
	!near|/near {*}|
	!topqual|/topqual {*}|
	!top|/top {*}|
	!drf|/drf {*}|
	
	....  Rest of your AutoMsgPrivate ....
	
6. Add a variable {*} in AutoMsgPrivate who is the rest of the line racer type in ( argument )

7. All private messages are multiline messages, each line is separated by ':' in the command line


+--------------------------+
|Changes from v5.01 to 5.02|
+--------------------------+

1. Auto Fusion of duplicate username player ( Now not Case sensitive )

2. Remove "demo." in username of demo server due to difference between dedi and LFS Standart

3. If demo server, username = nickname even if a licensed player connect to this server

4. Default, view PB Spb on config player

5. Fix PB on rename player in demo mode, retrieve info of renamed player

6. Auto update of old Demo PB file to remove "demo." and fusion of dupplicate player


+--------------------------+
|Changes from v5.00 to 5.01|
+--------------------------+

1. Fix bug when Lapper not have an internet connection for getting WR on PubStat

2. Fix nickname not visible in splitting notification

3. Remove User and Pass for connect to pubstat, Only idk

4. Fix Issue with demo player on PB.TXT

5. Fix serveur SPB Problem when race restart or on shift+P and rejoin race

+--------------------------+
|Changes from v4.10 to 5.00|
+--------------------------+

1. Many internal change for add new possibility

2. Save Number of Lap do on car/track in PB file

3. Add on ConnectMsg
	. {SessLaps} - Number of Lap on current track and current Car for the session
	. {Laps} - Number of Lap on current track and default Car
	. {Car} - Default car, because at this time, Lapper don't know your car
	. {ShortTrackName} - Current short Trackname
	. {TotalPitTime} - Total time of pitting

4. Add on PrivMessSpb(X)Up and PrivMessSpb(X)Low
	. {SessLaps} - Number of Lap on current track and current Car for the session
	. {Laps} - Number of Lap on current track and default Car
	. {Car} - Default car, because at this time, Lapper don't know your car
	. {TotalPitTime} - Total time of pitting

5. Add on AutoMsgPrivate
	. {SessLaps} - Number of Lap on current track and current Car for the session
	. {Laps} - Number of Lap on current track and default Car
	. {Car} - Car of current player or default car if in spectate mode
	. {UserName} - Username of driver that sent message, if demo player username = demo.nickname
	. {TotalPitTime} - Total time of pitting

6. Add on PBAction, DriftPBAction,DriftLapAction, GoodDriftAction, DriftTooLowAction
	. {Laps} - Number of Lap on current track and current Car
	. {SessLaps} - Number of Lap on current track and current Car for the session
	. {Car} - Car of current player or default car if in spectate mode
	. {TotalPitTime} - Total time of pitting

5. Add in SPB type
	. {typ} 	= "Sess" if split PB of Session
				= "PB" if split PB of PB file
				= "WR" if split of WR 

6. Add identification for connecting on PubStat and retreive WR
	. Identification for connect to showplay
	 : To obtain PubStatIdk go to www.lfsworld.net, select My LFSW Setting and select tab Pubstat Access
		The better way is obtain and idk, send login and pass on net it's not safe
		PubStatIdk = 
		PubStatLogin =
		PubStatPass =

7. Add private config of Lapper for player : Shift + i
	. Type of Sector PB to be Displayed ( Relative to : Session, Saved PB or wr )
	. Display SPB or No
	
8. Add the possibility to indicate a required handicap for a player in the player HandicapUsers item

9. Add OnToLowHandicap action

10. Intercept special key to close properly insim connection 
	. CtrlC, CtrlClose, CtrlBreak, CtrlLogoff, CtrlShutdown
	
11. Add Private message "BeginPitPrivMess" when pitting

12. Add Private message "EndPitPrivMess" when pit is finished

13. Add action "OnBeginPit" when pitting

12. Add action "OnEndPit" when pit is finished

13.	Fix regression bug on command : ShowPlayerControl
				

+--------------------------+
|Changes from v4.00 to 4.10|
+--------------------------+
1. Now message with command like !help, !top, ... can be send to player in pit stop or in observation mode

2. Fix insim difference between insim3 and insim4, split infos differ

3. Add file trackInfo.cfg for splitting ( 100.5% of WR split ) action and track length . Multisplitting time action and MaxLapTime for track/car and 

4. Add the possibility to display average speed only for last split notify : {AvgSpeed}


+-------------------------+
|Changes from v3.8 to 4.00|
+-------------------------+
1. New insim compatible (X)

2. Possibility to indicate a file of player who can use action in autoaction

3. Add pattern in cfg file for splitting information ( spb )

4. Add the possibility to indicate filenane containing the list of authorized user for autoaction separate by \n

5. Add new command !near to show your position in top file with 7 racer before you and 7 after you

6. Add the possibility of indicating which are the players taking part in the qualifications. list of users or file containing users

7. Add the possibility of grouping ( one letter ) qualified according to their times. new parameters: Max Group, Max users per group, Min users in the last group

8. Add new command !topqual to show position of players taking part in the qualifications

9. Add new command !nearqual to show your position in top file with 7 racer before you and 7 after you if you taking part in the qualification 

10. Add some variables in cfg file {Posabs} {Posqual} {Groupqual} to display then in some case


+-------------------------+
|Changes from v3.6 to v3.7|
+-------------------------+
1. Some Bug fix

+-------------------------+
|Changes from v3.5 to v3.6|
+-------------------------+
1. Add splitting information and Best split PB for your session and Theorical Best PB

2. Add new command !spb to show your Split PB

3. Add new command !razspb to clean your Split PB

4. Add new command in cfg : ShowSplitPB = true or false to display split PB or No

+-------------------------+
|Changes from v3.4 to v3.5|
+-------------------------+
1. User Username instead nickname when possible for PB. Allow no duplicate value on same driver with different nickname.

+-------------------------+
|Changes from v3.3 to v3.4|
+-------------------------+

1.Bug fix: Drift scoring angle was calculated incorrectly (backward driving exploit)

2.Bug fix: rcm messages did not work when there was no schedule in script.

3.New actions for 30 and 45 seconds penalties. (only works in English language server)

+-------------------------+
|Changes from v3.2 to v3.3|
+-------------------------+

1.rcm_ply messages are also automatically deleted.

2.New flooding options (see default script for example).

3.New action that activates when player enters pits (by pits option or SHIFT+S shortcut).

4.New action that activates when player leaves race (spectates or disconnects).

5.Global variables that can be used in all actions: {ShortTime}, {LongTime}, {ShortDate}, {LongDate}, {ShortTrackName}

6.Reserved symbols can be also used in actions: ':','|' and '@'.

7.Action for repeatable drive-through penalties. (only works in English language server)

8.Action for repeatable stop-go penalties. (only works in English language server)

+-------------------------+
|Changes from v3.1 to v3.2|
+-------------------------+

1.Removed CarStateRefresh option. Now fixed to 0.1 s.

2.Every configuration option in script can consist of more lines (following lines must begin with TAB).

3.Drift score is shown after each complete drift, not every second (CarStateRefresh).

4.New action to execute on good drifting score.

5.Acceleration measurement support (see default script for example).


+-------------------------+
|Changes from v3.0 to v3.1|
+-------------------------+

1.Possibility to transfer results files to FTP server.

2.Idling action with two levels of operation.
Works only in race and qualifications now and counter is reset at race start.

3.New action that is activated after predefined number of AngleVelocity events.

4.New integrated command to show drift score and position of player - !dstats (analogue to !stats command)

+-------------------------+
|Changes from v2.9 to v3.0|
+-------------------------+

1.Added support for BF1.

2.Improved drift scoring system + new options.

3.Possibility to specify users that are allowed to execute AutoActions.

+-------------------------+
|Changes from v2.8 to v2.9|
+-------------------------+

1.Username variable added to all actions, where Nickname can be used (except split warnings).

2.OnIdleAction.

3.Experimental Drifting scoring support. Drift hotlap table and action options for drifting.

4.Changed names of variables.

+-------------------------+
|Changes from v2.7 to v2.8|
+-------------------------+

1.Bug fix for sorting in top list (mono).

+-------------------------+
|Changes from v2.6 to v2.7|
+-------------------------+

1.Bug fix for ScheduledActions, where more schedule/action pairs were present.

+-------------------------+
|Changes from v2.5 to v2.6|
+-------------------------+

1.Delayed action for race restart.

2.Scheduled actions.

3.Support for non-ascii characters.

+-------------------------+
|Changes from v2.4 to v2.5|
+-------------------------+

1.!top and !stats command do not show invalid split times.

2.More commands can be defined for AutoAction, SplitActions, PBAction and AngleVelocityAction.

3.!stats command also shows position of player for every car.

4.New option: DefaultTopCar, see sample script for description and examples.

5.New variable available to use at AutoAction command - Username. Usable in licensed servers only.

6.New option: MaxLapTime, see sample script for description and example.

7.New option: MessageTime, see sample script for description and example.

+-------------------------+
|Changes from v2.3 to v2.4|
+-------------------------+

1.More words can be specified for same action or private message.

2.Action possible when angle velocity of a car reaches specified value!

3.ShowSplitWarnings option removed. If you wish to disable option just change max times to high values.

+-------------------------+
|Changes from v2.2 to v2.3|
+-------------------------+

1. Split times are also recorded. -> Changed file format.
Warning! Old files must be converted to new format before use!

+-------------------------+
|Changes from v2.1 to v2.2|
+-------------------------+

1.Changed file format;additional line for track name;
Warning! Old files must be converted to new format before use!

2.Possibility to change PB Message.

3.Possibility to change Split warnings.

4.Use of variables in messages.

5.Every track has its own PB table. Changing tracks does not mix up results anymore.

6.Debugging option. See command line usage.

